解决中文不显示问题
mpl.rcParams['font.sans-serif'] = ['SimHei']
mpl.rcParams['axes.unicode_minus'] = False
画出第一个图形...figure图形,画的每个图只有一个figure对象
x= np.arange(-3,3,0.1)
y1=np.sin(x)
#创建第一个figure
plt.figure()
#绘图
plt.plot...image.png
创建子图
在一个figure中显示多个图片
面向过程的方法,一步一步创建
x1=[1,2,3]
y1=[5,7,4]
x2=[1,2,3]
y2=[10,14,12]
plt.figure...()
plt.subplot(221)#第一个子图
plt.plot(x1,y1,'ro--')
plt.subplot(223)
plt.plot(x2,y2,'bo-')#第二个子图
plt.show...面向对象创建子图
#创建图形
fig=plt.figure()
#创建子图
ax1=fig.add_subplot(221)
ax2=fig.add_subplot(222)
ax3=fig.add_subplot