白璐123

2020-12-08   阅读量: 1388

Python 可视化 大数据 3*3不规则子图

Python matplotlib subplot画3*3不规则子图

扫码加入数据分析学习群

一般我们了解到的代码就是画出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);



image.png

63.1579 1 1 关注作者 收藏

评论(1)

ermutuxia
2020-12-08

真是太棒啦!

0.0000 0 0 回复

推荐课程

推荐帖子