我想在 matplotlib 中使图形的 x 轴更宽,我使用以下代码。但似乎 figsize 没有任何效果。如何更改图形的大小?
data_dates = np.loadtxt(file,usecols = 0, dtype=np.str)
data1 = np.loadtxt(file,usecols = 1)
data2 = np.loadtxt(file,usecols = 2)
data3 = np.loadtxt(file,usecols = 3)
plt.plot(figsize=(30,5))
plt.plot(data_dates,data1, label = "T")
plt.plot(data_dates,data2, label = "WS")
plt.plot(data_dates,data3, label = "WD")
plt.xlabel('Date', fontsize=8)
plt.xticks(rotation=90,fontsize=4)
plt.ylabel(' Percentage Difference (%)')
plt.legend()
plt.savefig(outfile,format='png',dpi=200,bbox_inches='tight')
该文件的样本是
01/06/2019 0.1897540512577196 0.28956205456965856 0.10983099750547703
02/06/2019 0.1914523564094276 0.1815325705314345 0.0004533827128655877
03/06/2019 0.2365346386184113 0.12301344973593868 0.058843355966174876
04/06/2019 0.2085897993039386 0.005466902564359565 0.014087537281676313
05/06/2019 0.15563355684612554 0.16249844426472368 0.11036007669758358
06/06/2019 0.11981475728282368 0.11015459703126898 0.03501167308950372