绘图的元素
- 画布 figure
- 标题 title
- 数据 data
- x轴
- x轴刻度 xticks
- x轴标签 xlabel
- y轴
- 去掉内存的注释地址 show()
out:[#不添加任何修饰
plt.plot(np.random.random_integers(-20,20,20))
]
#画1个图,画布大小为宽x高=10x4
plt.figure(1,figsize=(10,4))
#标题
plt.title('这是一个折线图')
#数据
plt.plot(np.random.random_integers(-20,20,20))
#x轴刻度
plt.xticks([0,5,10,20])
#x轴标签
plt.xlabel('x轴')
#去掉内存的注释地址 show()
plt.show()
