matplotlib画图

阿里云2000元红包!本站用户参与享受九折优惠!

import matplotlib.pyplot as plt
import os
from matplotlib.font_manager import FontProperties
font_xlabel=FontProperties(fname=r"c:\\windows\\Fonts\\times.ttf",size=10)#导入计算机中安装的字体并设置大小
x =[0,7.3333,16.6667,25,33.333333,41.66667,50] 
y1 = [0.44176,0.4346,0.42643,0.4169,0.41015,0.402,0.3968]
y2=[0.85923,0.8442,0.8291,0.8145,0.7991,0.7836,0.7683]
y3=[1.19863,1.178,1.15775,1.13859,1.11843,1.096,1.0783]
plt.plot(x,y1,linewidth=0.8,color='k')
plt.plot(x,y2,linewidth=0.8,color='k')
plt.plot(x,y3,linewidth=0.8,color='k')
plt.scatter(x, y1,s=4,color='k')
plt.scatter(x, y2,s=4,color='k')
plt.scatter(x, y3,s=4,color='k')
plt.xlabel('Xe(%)',fontproperties=font_xlabel)#坐标轴标题字体及大小
plt.ylabel('Lift Coefficient,CL',fontproperties=font_xlabel)
plt.yticks(fontproperties = font_xlabel)#坐标轴字体及大小
plt.xticks(fontproperties = font_xlabel)
plt.xlim([0,50])#坐标轴范围
plt.ylim([0.37,1.21])
ax=plt.twinx()#另一个y轴,共享x轴
ax.set_ylim([0.37,1.21])
plt.setp(ax.get_yticklabels(), visible=False)#不显示刻度值
plt.show()


Figure_1.png
https://www.jianshu.com/p/5b215f8cf825

「点点赞赏,手留余香」

    还没有人赞赏,快来当第一个赞赏的人吧!
0 条回复 A 作者 M 管理员
    所有的伟大,都源于一个勇敢的开始!
欢迎您,新朋友,感谢参与互动!欢迎您 {{author}},您在本站有{{commentsCount}}条评论