matplot绘图包
概要
1. Python绘图工具包
2. 仅需要几行代码,便可以生成绘图
3. 支持折线图、直方图、散点图、饼图、柱形图等。
代码示例
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 50)
print(x) # 生成0到10之间等距的50个点
y
y = 2*x + 1
plt.plot(x, y)
plt.show()
Figure绘图板
属性figsize
坐标轴
plt.xlim
plt.ylim
设置坐标轴标签
plt.xlabel
plt.ylabel
图例
label, legend
作用:为不同数据设置标签,即同一张图中不同曲线设置标签