整体思想,先使用fig = plt.figure(),ax=fig.add_subplot()
建立图片,画好图以后,用ax.set_xxx来设置各项参数svg
plt.subplots_adjust(wspace, hspace):参数分别表明水平间距和竖直间距函数
set_xticks:刻度值的显示值spa
set_xticklabels:将任意标签转换为x轴标签code
set_xlim:只显示某一部分的时候使用对象
ax.set_xticks(range(0,1001,250)) ax.set_xticklabels(['one','two','three','four','five'],rotation=30,fontsize='small')
一样y轴同理索引
set_title:设置图片titlethree
set_xlabel:设置x轴的名称图片
fig = plt.figure() ax = fig.add_subplot(1,1,1) ax.plot(randn(1000).cumsum(),'k-') ax.set_xticks(range(0,1001,250)) ax.set_xticklabels(['one','two','three','four','five'],rotation=30,fontsize='small') ax.set_xlabel('stage') plt.show()
在画图的时候传入label,在添加图例的时候用legend就行了pandas
ax.plot(randn(1000).cumsum(),'k-',label='one') ax.plot(randn(1000).cumsum(),'g--',label='two') ax.plot(randn(1000).cumsum(),'r-',label='three') ax.legend(loc='best')
注释能够经过text,arrow,annotate等函数添加it
plt.savefig('a.svg')
label:用于图例的标签
ax:绘制的画布
style:风格,包括颜色和线型
alpha:不透明度,0-1
kind:'line','bar','barh','kde'
logy:对y轴作对数
use_index:将对象的索引用做刻度标签
rot:旋转刻度标签(0-360)
xticks:用做x轴刻度的值
yticks:用做y刻度的值
xlim,ylim:x,y轴界限
grid:显示网格线
subplots:将各个dataframe列绘制到单独的subplot中
sharex,sharey:若是subplots为true,共用一个x轴,或y轴
figsize:图像大小
title:名称
legend:添加图例,默认为true
sort_columns:以字母表顺序绘制各列