一般我们了解到的代码就是画出2行2列的子图做法,下面分享一下个人最近做出来的使用subplot画出的3*3的子图。
欢迎随时交流~
代码原码:
plt.figure( figsize=(16,9),dpi=300)
plt.subplot(334)
plt.plot(df1.c,df1.b);
plt.subplot(335)
plt.pie(df1.d);
plt.subplot(336)
plt.bar(df.b.index,df.b);
plt.subplot(321)
plt.boxplot(df1,sym="*",whis=50,widths=0.3,labels=df.index);
plt.subplot(322)
r=["g","y","b","orange"]
plt.pie(df1.c,labels=df.index,autopct="%.2f%%",radius=1,wedgeprops=dict(linewidth=2,width=0.3,edgecolor="w"),colors=r);
plt.pie(df1.b,autopct="%.2f%%",radius=0.7,wedgeprops=dict(linewidth=2,width=0.3,edgecolor="w"),colors=r);
plt.subplot(313)
bar_width=0.2
plt.bar(df1.d.index,df1.d,bar_width)
plt.bar(pd.Series(df1.d.index).index+0.2,df1.a,bar_width)
plt.bar(pd.Series(df1.d.index).index+0.2*2,df1.b,bar_width)
plt.bar(pd.Series(df1.d.index).index+0.2*3,df1.c,bar_width);
plt.savefig("test.jpg",dpi=300);





