Low-level API for creating a GridSpec that has this figure as a parent.
This is a low-level API, allowing you to create a gridspec and subsequently add subplots based on the gridspec. Most users do not need that freedom and should use the higher-level methods subplots or subplot_mosaic.
Number of rows in grid.
Number of columns in grid.
Keyword arguments are passed to GridSpec.
See also
Adding a subplot that spans two rows:
fig = plt.figure() gs = fig.add_gridspec(2, 2) ax1 = fig.add_subplot(gs[0, 0]) ax2 = fig.add_subplot(gs[1, 0]) # spans two rows: ax3 = fig.add_subplot(gs[:, 1])
matplotlib.figure.Figure.add_gridspec
© 2012–2023 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.add_gridspec.html