Enhanced subplots with margins.
Importing the subplots module modifies the matplotlib functions
import matplotlib.pyplot as plt
Then the following features are available:
In matplotlib margins, i.e. the space between the axes and the figure
edges, are controlled via
arguments to the
fig.subplots_adjust() and related functions. These
arguments are given in fractions of the figure size as values ranging
between 0 and 1. This is often quite cumbersome, because the margins
get bigger if the figure size is enlarged, although the size of the
tick and axis labels stay the same.
The subplots module introduces
bottomm as additional arguments to the
functions. These arguments specify the margins in units of the current
font size, because the font size is what sets the size of the tick and
axis labels. And they are measured from the respective figure edge,
not from the figure's origin. I.e. specifying
topm=0 is the same as
top=1, and results in no margin at the top of the upper axes. In
addition, a resize event handler is installed, that ensures that the
margins stay the same (when specified by the new arguments) when you
resize the figure on the screen.
TODO: image illustrating figure margins.
plt.subplots() can be called with
figure.add_gridspec() is made available for older
matplotlib versions that do not have this function yet.
To merge several subplots into a single axes, call