"" To
draw multiple children
a figure object can contain more than one child graph (Axes), in Matplotlib, a plot area, called a child graph, with Axes object, you can use subplot () to quickly draw a chart containing multiple child graphs. It is called as follows: the
entire drawing area of the subplot (numrows,numcols,plotnum)
chart is divided into numrows rows and Numcols columns, and then numbering each region in Left-to-right order, The upper-left area is numbered 1. The Plotnum parameter specifies the area of the created Axes object ""
"
import numpy as NP
import Matplotlib.pyplot as Plt
plt.figure (1) #创建图表1
plt.figure (2) #创建图表2
Ax1=plt.subplot (211) #在图表2中创建子图1
Ax2=plt.subplot (212) #在图表2中创建子图2
x= Np.linspace (0,3,100) for
i in Xrange (5):
plt.figure (1)
Plt.plot (X,np.exp (I*X/3))
Plt.sca (AX1)
Plt.plot (X,np.sin (i*x))
Plt.sca (ax2)
Plt.plot (X,np.cos (i*x))
plt.show ()