import pylab as pl
from matplotlib.pyplot import MultipleLocator
#坐标轴的说明
pl.xlabel('x', fontdict = font_lable)
pl.ylabel('y', fontdict = font_lable)
#坐标轴标签
pl.xticks(fontproperties=font_ticks)
pl.yticks(fontproperties=font_ticks)
#刻度间距
x_major_locator=MultipleLocator(1)
y_major_locator=MultipleLocator(1)
ax.xaxis.set_major_locator(x_major_locator)
ax.yaxis.set_major_locator(y_major_locator)
#坐标轴原点不显示为零点
pl.axis([0, 5, 0, 5])
#pl.xlim(0,16)
#pl.ylim(0.0,2.7e-7)
#坐标轴上数字小数点位数太多
f, ax = plt.subplots(1, 1)
ax.yaxis.get_major_formatter().set_powerlimits((0,2)) #将y轴的刻度值设置为两位小数,科学计数法表示
#添加图例
plt.legend([line1,line2,line3,line4,line5,line6],["a=0.01", "a=0.25","a=0.5","a=0.7", "a=0.8","a=1"],loc='upper left',fontsize='x-large')
pylab 图形坐标轴、标签、间距
最新推荐文章于 2021-03-25 10:44:32 发布