fonts opt update 03
This commit is contained in:
parent
91888ace76
commit
c3fffb2d10
|
@ -13,14 +13,25 @@ SimSun = font_manager.FontProperties(fname="./fonts/SimSun.ttc", size=12)
|
|||
TimesNesRoman = font_manager.FontProperties(
|
||||
fname="./fonts/TimesNewRoman.ttf", size=12)
|
||||
|
||||
|
||||
def create_chart(x, y, today):
|
||||
# 创建折线图
|
||||
def createLineChart(x, y, today):
|
||||
# x, y为两个list
|
||||
plt.plot(x, y, color='r', marker='o') # 线型
|
||||
plt.plot(x, y, color='r', marker='o', label='时间点') # 线型
|
||||
# plt.axis([0, 6, 0, 20])
|
||||
plt.title('OpenCV Webcam Script v0.5', fontproperties=TimesNesRoman) # 标题
|
||||
plt.title(f'OpenCV Webcam Script v0.5 {today}',
|
||||
fontproperties=TimesNesRoman) # 标题
|
||||
plt.xlabel(today, fontproperties=TimesNesRoman) # 横轴,时间
|
||||
plt.ylabel('帧数', fontproperties=TimesNesRoman) # 纵轴,帧数
|
||||
plt.ylabel('帧数', fontproperties=SimSun) # 纵轴,帧数
|
||||
|
||||
plt.savefig('test.png', dpi=100, bbox_inches='tight') # 保存图像
|
||||
plt.xticks(fontproperties=TimesNesRoman) # 横轴刻度
|
||||
plt.yticks(fontproperties=TimesNesRoman) # 纵轴刻度
|
||||
plt.legend(prop=SimSun) # 图例
|
||||
|
||||
plt.savefig('./chart.png', dpi=300, bbox_inches='tight') # 保存图像
|
||||
# plt.show()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
x = [1, 2, 3, 4]
|
||||
y = [1, 4, 9, 16]
|
||||
createLineChart(x, y, "abc")
|
||||
|
|
Loading…
Reference in New Issue