Figure.add_subplot

Figure.add_subplot(**kwargs)[source]

Add a subplot axes to the figure.

Parameters
  • *args (int, tuple, or SubplotSpec, optional) – 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 proplot GridSpec.

    For integer input, the implied geometry must be compatible with the implied geometry from previous calls – for example, fig.add_subplot(331) followed by fig.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, but fig.add_subplot(232) will raise an error because 2 rows cannot be tiled into 3 rows. For SubplotSpec input, the SubplotSpec must be derived from the GridSpec 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. See format for details. By default this is incremented automatically based on the other subplots in the figure. Use e.g. number=None or number=False to ensure the subplot has no a-b-c label. Note the number corresponding to a is 1, not 0.

  • autoshare (bool, default: True) – Whether to automatically share the x and y axes with subplots spanning the same rows and columns based on the figure-wide sharex and sharey settings. This has no effect if rc['subplots.share'] is False or if sharex=False or sharey=False were passed to the figure.

  • proj, projection (str, cartopy.crs.Projection, or Basemap, optional) – The map projection specification(s). If 'cart' or 'cartesian' (the default), a CartesianAxes is created. If 'polar', a PolarAxes is created. Otherwise, the argument is interpreted by Proj, and the result is used to make a GeoAxes (in this case the argument can be a cartopy.crs.Projection instance, a Basemap instance, or a projection name listed in this table).

  • proj_kw, projection_kw (dict-like, optional) – Keyword arguments passed to Basemap or cartopy Projection classes on instantiation.

  • backend ({'cartopy', 'basemap'}, default: rc['geo.backend'] = 'cartopy') – Whether to use Basemap or Projection for map projections.

Other Parameters

**kwargs – Passed to the proplot class proplot.axes.CartesianAxes, proplot.axes.PolarAxes, proplot.axes.GeoAxes, or proplot.axes.ThreeAxes. This can include keyword arguments for projection-specific format commands.