April 2018
Beginner to intermediate
300 pages
7h 34m
English
It is not a must for subplots to align side by side. In some occasions, such as when zooming in or out, we can also embed subplots on top of the parent plot layer. This can be done by fig.add_axes(). To add a subplot, here is the basic usage:
fig = plt.figure() # or fig = plt.gcf()fig.add_axes([left, bottom, width, height])
The left, bottom, width, and height parameters are specified relative to the parent figure in terms of float. Note that fig.add_axes() returns an axes object, so you may store it as a variable such as ax = fig.add_axes([left, bottom, width, height]) for further adjustments.
The following is a complete example where we try to plot the overview in a smaller embedded subplot:
import ...
Read now
Unlock full access