This article mainly introduces Python using Add_subplot and subplot operation, involving Python using the Matplotlib module for graphic drawing of the relevant operation skills, the need for friends can refer to the following
This example describes Python operations using Add_subplot and subplot. Share to everyone for your reference, as follows:
Sub-graph: It is in a figure inside the generation of multiple sub-graphs.
Introduction to Matplotlib Objects
Figurecanvas Canvas
Figure Chart
Axes Axis (where the actual drawing is)
Note thatthe arguments and meanings in the Pyplot are the same in both the parameters and the plt.subplot() object-oriented manner add_subplot() .
Using object-oriented methods
#!/usr/bin/python#coding:utf-8import NumPy as Npimport matplotlib.pyplot as Pltx = Np.arange (0, +) FIG = plt.figure () ax1 = Fig.add_subplot (221) Ax1.plot (x, x) ax2 = Fig.add_subplot (222) Ax2.plot (x, x) ax3 = Fig.add_subplot (223) Ax3.plot (x, x * * 2) ax4 = Fig.add_subplot (224) Ax4.plot (x, Np.log (x)) Plt.show ()
The way of Pyplot
#!/usr/bin/python#coding:utf-8import NumPy as Npimport matplotlib.pyplot as Pltx = Np.arange (0, +) plt.subplot (221) PLT . plot (x, x) plt.subplot (222) Plt.plot (x, x.) plt.subplot (223) Plt.plot (x, x * * 2) Plt.subplot (224) Plt.plot (x, Np.log (x)) Plt.show ()
Operation Result: