目录
一、绘制折线图
matplotlib:最流行的python底层绘图库,主要做数据可视化图表,名字取材于MATLAB,模仿MATLAB构建。
我们看一下使用matplotlib绘制折线图,具体如下:
python代码如下:
from matplotlib import pyplot as plt #导入pyplot包
import matplotlib
matplotlib.rc("font", family='YouYuan')
x = range(2, 26, 2)
y = [15, 13, 14.5, 17, 20, 25, 26, 26, 24, 22, 18, 15]
plt.xticks(range(min(x),max(x)+2,2)) #设置坐标刻度
plt.yticks(range(min(y),max(y)+2,1))
plt.plot(x,y)
plt.xlabel("时间:单位(hours)")
plt.ylabel("