import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-3,3,50)
y1 = 2*x+1
y2 = x**2
plt.figure()后面紧跟每一个图形窗口
plt.figure()
plt.plot(x,y1)plt.figure()
plt.plot(x,y2)plt.show()

文章图片
y1 = 2*x+1.png

文章图片
y2 = x**2.png 两条线绘在同一窗口
plt.figure(num=3,figsize=(8,5))
plt.plot(x,y2)
plt.plot(x,y1,color='red',linewidth=1.0,linestyle='--')
plt.show()

文章图片
image.png 【Figure|Figure 图像】Matplotlib学习教程来源请戳这里