图例保存对象
# x与y知足什么线性关系,就能绘制出什么样的图片
x = np.array([1,2,3,4,5])
y = x + 2
plt.plot(x,y) 索引
# 抛物线
x = x
y = x**2
plt.plot(x,y) 图片
# 在一个坐标系中绘制多条曲线
plt.plot(x,y)
plt.plot(x-2,y+3) it
# 设置轴表示的含义
plt.plot(x,y)
plt.xlabel('temp') # x轴
plt.ylabel('dist') # y轴
plt.title('wenduquxian') # 标题 数据
plt.plot(x,y,label='line_a')
plt.plot(x-2,y+3, label='line_b')
plt.legend() 样式
# 等比例的放大或者缩小坐标系(坐标的刻度是不会发生改变)
plt.figure(figsize=(9,6)) # 这段代码必定要写在绘图操做以前
plt.plot(x,y,label='line_a')
plt.plot(x-2,y+3, label='line_b')
plt.legend() di
# 保存图像必须按照下边这个步骤绘图
fig = plt.figure()参数
plt.plot(x,y,label='aaa')
plt.plot(x-2,y+3,label='bbb')
plt.legend()实例化
fig.savefig('./123.png')