更改图形大小

时间:2020-05-24 18:59:35

标签: python matplotlib

我需要更改以下代码生成的绘图的图形大小。

import matplotlib.pyplot as plt
%matplotlib inline

df.index = df.Date
df.drop(["Date"],  axis=1, inplace=True)
df.plot(kind="bar", stacked=True)
plt.xticks(rotation = 45)
plt.figure(figsize=(20,8))
plt.show()

在x轴上,我有100天的时间,目前无法轻松读取数据。我试图使用plt.figure,但是不幸的是,一切都没有改变。我该如何解决?

2 个答案:

答案 0 :(得分:0)

尝试以下操作:

  1. 创建所需大小的图形
  2. 将创建的轴传递给products_df.to_excel("C:\\Users\\gomes\\Desktop\\preços.xlsx") 命令

df.plot()

答案 1 :(得分:0)

在调用plt.figure(figsize=(20,8))函数之前尝试使用df.plot()

import matplotlib.pyplot as plt
%matplotlib inline

    df.index = df.Date
    df.drop(["Date"],  axis=1, inplace=True)
    plt.figure(figsize=(20,8))
    df.plot(kind="bar", stacked=True)
    plt.xticks(rotation = 45)
    plt.show()
相关问题