April 2018
Beginner to intermediate
300 pages
7h 34m
English
There is an add_subplot() function similar to plt.subplot() under plt.figure() that allows us to create additional subplots under the same figure. Similar to plt.subplot(), it takes the row number, column number, and plot number as input arguments and allows arguments without commas for fewer than 10 plots.
We can also initiate the first subplot using this function. This code is a quick example:
import matplotlib.pyplot as pltfig = plt.figure()ax = fig.add_subplot(111) plt.show()
This creates an empty plot area enclosed by four spines containing the x axis and y axis, as shown below. Note that we must call the add_subplot() function under a figure but not by plt:
Let us further compare the differences ...
Read now
Unlock full access