Figure.add_subplot¶
- Figure.add_subplot(*args, number=None, **kwargs)[source]¶
Add a subplot axes to the figure.
- Parameters
*args (
int
,(int
,int
,int
or2-tuple
ofint)
, orSubplotSpec
) – The subplot location specifier. Your options are:A single 3-digit integer argument specifying the number of rows, number of columns, and gridspec number (using row-major indexing).
Three positional arguments specifying the number of rows, number of columns, and gridspec number (int) or number range (2-tuple of int).
A
SubplotSpec
instance generated by indexing a ProPlotGridSpec
.
For integer input, the implied geometry must be compatible with the implied geometry from previous calls – for example,
fig.add_subplot(331)
followed byfig.add_subplot(132)
is valid because the 1 row of the second input can be tiled into the 3 rows of the the first input, butfig.add_subplot(232)
will raise an error because 2 rows cannot be tiled into 3 rows. ForSubplotSpec
input, theSubplotSpec
must be derived from theGridSpec
used in previous calls.These restrictions arise because we allocate a single, unique
gridspec
for each figure.number (
int
, optional) – The axes number used for a-b-c labeling. Seeformat
for details. By default this is incremented automatically based on the other subplots in the figure. Use0
orFalse
to ensure the subplot has no a-b-c label. Note the number corresponding toa
is1
, not0
.autoshare (
bool
, optional) – Whether to automatically share the x and y axes with subplots spanning the same rows and columns based on the figure-widesharex
andsharey
settings. Default isTrue
. This has no effect ifrc['subplots.share']
isFalse
or ifsharex=False
orsharey=False
were passed to the figure.proj, projection (
str
,cartopy.crs.Projection
, orBasemap
, optional) – The map projection specification(s). If'cart'
or'cartesian'
(the default), aCartesianAxes
is created. If'polar'
, aPolarAxes
is created. Otherwise, the argument is interpreted byProj
, and the result is used to make aGeoAxes
(in this case the argument can be acartopy.crs.Projection
instance, aBasemap
instance, or a projection name listed in this table).proj_kw, projection_kw (dict-like, optional) – Keyword arguments passed to
Basemap
or cartopyProjection
classes on instantiation.basemap (
bool
or dict-like, optional) – Whether to useBasemap
orProjection
for map projections. Default isrc.basemap
=False
.
- Other Parameters
**kwargs – Passed to
matplotlib.axes.Axes
.