图尺寸 1440x720 0 轴 - 如何绘制更大的图
Figure size 1440x720 with 0 Axes - how to plot bigger figure
我想绘制更大的图。按照之前 post 中的建议,我从
- 没有改变
你能告诉我哪里错了吗..
如果您在使用 df.plot
时不使用 ax=
kwarg 提供现有的 Axes
对象,pandas
将创建一个新图形,并绘制在在那里,这就是为什么它忽略了你现有的更大的数字。
因此,您可以创建 Axes
对象并在使用 df.plot
时将其传入。
而不是 fig = plt.figure(figsize=(20, 10))
,尝试使用:
fig, ax = plt.subplots(figsize=(20, 10))
...
df.plot(x='date', y='GVA', legend=True, color='g', ax=ax)
...
我想绘制更大的图。按照之前 post 中的建议,我从
你能告诉我哪里错了吗..
如果您在使用 df.plot
时不使用 ax=
kwarg 提供现有的 Axes
对象,pandas
将创建一个新图形,并绘制在在那里,这就是为什么它忽略了你现有的更大的数字。
因此,您可以创建 Axes
对象并在使用 df.plot
时将其传入。
而不是 fig = plt.figure(figsize=(20, 10))
,尝试使用:
fig, ax = plt.subplots(figsize=(20, 10))
...
df.plot(x='date', y='GVA', legend=True, color='g', ax=ax)
...