对pandas的dataframe绘图并保存

 

对dataframe绘图并保存:

ax = df.plot() 
fig = ax.get_figure()
fig.savefig('fig.png')

 

可以制定列,对该列各取值作统计:

label_dis = df.label.value_counts()
ax = label_dis.plot(title='label distribution', kind='bar', figsize=(18, 12))
fig = ax.get_figure()
fig.savefig('label_distribution.png')

 

posted @ 2017-08-04 17:54  焦距  阅读(5423)  评论(0编辑  收藏  举报