import matplotlib.pyplot as plt import matplotlib.font_manager a = [1,0,1,1,2,4,3,2,3,4,4,5,6,5,4,3,3,1,1,1] b = [1,0,3,1,2,2,3,3,2,1,2,1,1,1,1,1,1,1,1,1] ax=range(11,31) bx=ax myfont=matplotlib.font_manager.FontProperties(fname="C://Windows//Fonts//Msyh.ttc") fig=plt.figure(figsize=(20,8),dpi=70) plt.plot(ax,a,label='自己',linestyle='--',c='cyan') plt.plot(bx,b,c='r',linestyle='-',label='同桌') plt.legend(prop=myfont,loc=0) plt.grid(alpha=0.8,linestyle=':',c='orange') _xticks=list('{}岁'.format(i) for i in ax) plt.xticks(ax,_xticks,rotation=45,fontproperties=myfont) plt.xticks() plt.show()
matplotlib折线图画法
最新推荐文章于 2024-08-21 23:42:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)