April 2018
Beginner to intermediate
300 pages
7h 34m
English
To initiate the axes plot instances that actually frame each plot, we can use plt.subplot(). It takes three parameters: number of rows, number of columns, and plot number. When the total number of plots is less than 10, we can omit the delimiting commas in the input arguments. Here is a code snippet example:
import matplotlib.pyplot as plt# Initiates a figure area for plottingfig = plt.figure()# Initiates six subplot axesax1 = plt.subplot(231)ax2 = plt.subplot(232)ax3 = plt.subplot(233)ax4 = plt.subplot(234)ax5 = plt.subplot(235)ax6 = plt.subplot(236)# Print the type of ax1print(type(ax1))# Label each subplot with corresponding identitiesax1.text(0.3,0.5,'231',fontsize=18)ax2.text(0.3,0.5,'232',fontsize=18) ...
Read now
Unlock full access