python调整⼦图布局_matplotlib中精确调整⼦图形⼤⼩我在A4纸上绘制⼀些索引数据,⽤3x2⾏列的6幅图像绘制。我已经得到了基本的代码⼯作,它将这个数据帧数据绘制成以下6个图。在def plot_idx(df,image,key):
# reset the default parameters
fig = plt.figure()
#plot all the 6 figures and save the 3x2 image as png
ax1 = fig.add_subplot(321) # first row first image
#compute all time
alltime = df['Close'].count()
x,y,x_min, y_min, x_max, y_max = min_max(df,alltime)
ax1.plot(x, y,'r')
ax1.plot(x_min,y_min,'o')
ax1.plot(x_max,y_max,'o')
ax1.set_xlabel('year')
ax1.set_ylabel('Index Close')
matplotlib中subplotax1.set_title(plot_title[-1])
ax1.fill_between(x,y,facecolor='red')
ax1.annotate(y_min, xy=(x_min,y_min), xytext=(x_min,y_min +250))
ax1

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。