matplotlib的基本使用
1、安装matplotlib
2、绘制折线图
from matplotlib import pyplot as plt
x = range(0, 10)
y = [15, 23, 2, 3, 4, 5, 6, 13, 2, 32]
plt.figure(figsize=(10, 8), dpi=60)
plt.plot(x, y)
plt.show()

- 设置x轴或者y轴的刻度
plt.xticks(arg)
,plt.yticks(arg)
,arg可以是一个序列 plt.xticks(x)
plt.xticks(range(1,10,3))
- x,y轴还支持字符串显示,
- matplotlib默认不支持中文字体需要修改matplotlib的字体
plt.rc("font",family="STSong")
xtick_labels=["10点{}分".format(i) for i in range(10)]
plt.xticks(x,xtick_labels,rotation=45,fontProperties="STSong")
plt.xlabel("时间")
plt.ylabel("温度 单位(℃)")
plt.title("十点到十点十分的温度变化")

plt.savefig("./a.svg")