1、#导入matplotlib.pyplot和numpy模块
import matplotlib.pyplot as plt
import numpy as np
2、#设置x轴和y轴
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(6)
y1 = np.array([10, 1, 7, 17, 19,21])
y2 = np.array([0, 1, 10, 4, 20,22])
3、#绘制折线图
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(6)
y1 = np.array([10, 1, 7, 17, 19,21])
y2 = np.array([0, 1, 10, 4, 20,22])
fig = plt.figure ()
#在画布fig上添加坐标系风格的绘图区域ax
ax = fig.add_subp1ot(111)
ax.plot(x, y1, x, y2)
plt.show()
4、#图像显示