Axes

class Axes(*args, **kwargs)[source]

Bases: matplotlib.axes._axes.Axes

The lowest-level Axes subclass used by proplot. Implements basic universal features.

Parameters

*args, **kwargs – Passed to Axes.

Attributes Summary

number

The axes number.

Methods Summary

colorbar(**kwargs)

Add an inset colorbar or an outer colorbar along the edge of the axes.

draw([renderer])

Draw everything (plot lines, axes, labels)

format(**kwargs)

Format the a-b-c label, axes title(s), and background patch, and call proplot.figure.Figure.format.

get_tightbbox(renderer, *args, **kwargs)

Return the tight bounding box of the axes, including axis and their decorators (xlabel, title, etc).

indicate_inset_zoom(**kwargs)

Draw lines indicating the zoom range of the inset axes.

inset(*args, **kwargs)

Add an inset axes.

inset_axes(bounds[, transform, proj, ...])

Add an inset axes.

legend([handles, labels, loc, location, queue])

Add an inset legend or outer legend along the edge of the axes.

panel(*args, **kwargs)

Add a panel along the edge of the axes.

panel_axes(*args, **kwargs)

Add a panel along the edge of the axes.

text(*args[, border, bordercolor, ...])

Add text to the axes.

Attributes Documentation

number

The axes number. This controls the order of a-b-c labels and the order of appearence in the SubplotGrid returned by proplot.figure.Figure.subplots and proplot.ui.subplots.

Methods Documentation

colorbar(**kwargs)[source]

Add an inset colorbar or an outer colorbar along the edge of the axes.

Parameters
  • mappable (mappable, sequence of artist, sequence of color-spec, or colormap-spec) – There are four options here:

    1. A mappable object. Basically, any object with a get_cmap method, like the objects returned by contourf and pcolormesh.

    2. A sequence of matplotlib artists. Any object with a get_color method will do, like Line2D instances. A colormap will be generated from the colors of these objects, and colorbar levels will be selected using values. If values is None, we try to infer them by converting the handle labels returned by get_label to float. Otherwise, it is set to np.linspace(0, 1, len(mappable)).

    3. A sequence of hex strings, color string names, or RGB tuples. A colormap will be generated from these colors, and colorbar levels will be selected using values. If values is None, it is set to np.linspace(0, 1, len(mappable)).

    4. A Colormap instance. In this case, a colorbar will be drawn using this colormap and with levels determined by values. If values is None, it is set to np.linspace(0, 1, cmap.N).

  • values (sequence of float or str, optional) – Ignored if mappable is a mappable object. This maps each color or plot handle in the mappable list to numeric values, from which a colormap and normalizer are constructed. These can also be strings, in which case the list indices are used for tick locations and the strings are applied as tick labels.

  • loc, location (str, optional) – The colorbar location. Default is rc['colorbar.loc'] = 'right'. Valid location keys are shown in the below table.

    Location

    Valid keys

    outer left

    'left', 'l'

    outer right

    'right', 'r'

    outer bottom

    'bottom', 'b'

    outer top

    'top', 't'

    default inset

    'best', 'inset', 'i', 0

    upper right inset

    'upper right', 'ur', 1

    upper left inset

    'upper left', 'ul', 2

    lower left inset

    'lower left', 'll', 3

    lower right inset

    'lower right', 'lr', 4

    “filled”

    'fill'

  • length (float or unit-spec, optional) – The colorbar length. For outer colorbars, default is rc['colorbar.length'] = 1.0 and units are relative to the axes width or height. For inset colorbars, default is rc['colorbar.insetlength'] = 8.0 and units are absolute. If float, units are em-widths. If string, interpreted by units.

  • shrink (float, optional) – Alias for length. This is included for consistency with matplotlib.figure.Figure.colorbar.

  • width (unit-spec, optional) – The colorbar width. For outer colorbars, default is rc['colorbar.width'] = 0.2. If float, units are inches. If string, interpreted by units. For inset colorbars, default is rc['colorbar.insetwidth'] = 1.2. If float, units are em-widths. If string, interpreted by units.

  • queue (bool, optional) – If True and loc is the same as an existing colorbar, the input arguments are added to a queue and this function returns None. This is used to “update” the same colorbar with successive ax.colorbar(...) calls. If False (the default) and loc is the same as an existing inset colorbar, the old colorbar is removed. If False and loc is an outer colorbar, the colorbars are stacked.

  • space (unit-spec, optional) – For outer colorbars only. The fixed space between the colorbar and the subplot edge. If float, units are em-widths. If string, interpreted by units. When the tight layout algorithm is active for the figure, this is adjusted automatically using pad. Otherwise, a suitable default is selected.

  • pad (unit-spec, optional) – For outer colorbars, this is the tight layout padding between the colorbar and the subplot. Default is rc['subplots.panelpad'] = 0.5. For inset colorbars, this is the fixed space between the axes edge and the colorbar. Default is rc['colorbar.insetpad'] = 0.7. If float, units are em-widths. If string, interpreted by units.

  • align ({'center', 'top', 't', 'bottom', 'b', 'left', 'l', 'right', 'r'}, optional) – For outer colorbars only. How to align the colorbar against the subplot edge. Default is 'center'. The values 'top' and 'bottom' are valid for left and right colorbars and 'left' and 'right' are valid for top and bottom colorbars. The default is always 'center'. Has no visible effect if length is 1.

Other Parameters
  • extend ({None, 'neither', 'both', 'min', 'max'}, optional) – Direction for drawing colorbar “extensions” (i.e. references to out-of-bounds data with a unique color). These are triangles by default. If None, we try to use the extend attribute on the mappable object. If the attribute is unavailable, we use 'neither'.

  • extendfrac (float, optional) – The length of the colorbar “extensions” relative to the length of the colorbar. This is a native matplotlib colorbar keyword.

  • extendsize (unit-spec, optional) – The length of the colorbar “extensions” in physical units. Default is rc['colorbar.insetextend'] = 0.9 for inset colorbars and rc['colorbar.extend'] = 1.3 for outer colorbars. If float, units are em-widths. If string, interpreted by units.

  • norm (norm-spec, optional) – Ignored if values is None. The normalizer for converting values to colormap colors. Passed to Norm.

  • norm_kw (dict-like, optional) – The normalizer settings. Passed to Norm.

  • reverse (bool, optional) – Whether to reverse the direction of the colorbar.

  • tickloc, ticklocation ({'bottom', 'top', 'left', 'right'}, optional) – Where to draw tick marks on the colorbar.

  • tickdir, tickdirection ({'out', 'in', 'inout'}, optional) – Direction of major and minor colorbar ticks.

  • tickminor (bool, optional) – Whether to add minor ticks using minorticks_on.

  • label, title (str, optional) – The colorbar label. The title keyword is also accepted for consistency with legend.

  • labelsize, labelweight, labelcolor (optional) – The font size, weight, and color for colorbar label text.

  • locator, ticks (locator-spec, optional) – Used to determine the colorbar tick positions. Passed to the Locator constructor function.

  • locator_kw (dict-like, optional) – The locator settings. Passed to Locator.

  • minorlocator, minorticks – As with locator, ticks but for the minor ticks.

  • minorlocator_kw – As with locator_kw, but for the minor ticks.

  • maxn (int, optional) – Used if locator is None. Determines the maximum number of levels that are ticked. Default depends on the colorbar length relative to the font size. The name maxn is meant to be reminiscent of MaxNLocator.

  • maxn_minor – As with maxn, but for the minor ticks.

  • format, formatter, ticklabels (formatter-spec, optional) – The tick label format. Passed to the Formatter constructor function.

  • formatter_kw (dict-like, optional) – The formatter settings. Passed to Formatter.

  • rotation (float, optional) – The tick label rotation. Default is 0.

  • ticklabelsize, ticklabelweight, ticklabelcolor (optional) – The font size, weight, and color for colorbar tick labels.

  • grid, edges, drawedges (bool, optional) – Whether to draw level dividers (i.e., gridlines) between each distinct color. Default is rc['colorbar.grid'] = False.

  • frame, frameon (bool, optional) – For inset colorbars only. Indicates whether to draw a “frame”, just like legend. Default is rc['colorbar.frameon'] = True.

  • a, alpha, framealpha, fc, facecolor, framecolor, ec, edgecolor, ew, edgewidth (optional) – For inset colorbars only. Controls the transparency and color of the frame. Defaults are rc['colorbar.framealpha'] = 0.8 and rc['colorbar.framecolor'].

  • lw, linewidth, c, color (optional) – Controls the line width and edge color for both the colorbar outline and the level dividers.

  • edgefix (bool or float, optional) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics. This can slow down figure rendering. Default is rc.edgefix = True. If True, a small default linewidth is used to cover up the white lines. If float, this linewidth is used.

  • rasterize (bool, optional) – Whether to rasterize the colorbar solids. The matplotlib default is True but we change this to rc['colorbar.rasterize'] because rasterization can cause misalignment between edges and the level patches.

  • orientation ({None, 'horizontal', 'vertical'}, optional) – The colorbar orientation. By default this depends on the “side” of the subplot or figure where the colorbar is drawn. Inset colorbars are always horizontal.

  • **kwargs – Passed to colorbar.

draw(renderer=None, *args, **kwargs)[source]

Draw everything (plot lines, axes, labels)

format(**kwargs)[source]

Format the a-b-c label, axes title(s), and background patch, and call proplot.figure.Figure.format.

Parameters
  • title (str, optional) – The axes title.

  • abc (bool or str, optional) – The “a-b-c” subplot label style. Must contain the character a or A, for example 'a.', or 'A'. If True then the default style of 'a' is used. The a or A is replaced with the alphabetic character matching the number. If number is greater than 26, the characters loop around to a, …, z, aa, …, zz, aaa, …, zzz, etc.

  • abcloc, titleloc (str, optional) – Strings indicating the location for the a-b-c label and main title. The following locations are valid (defaults are rc['abc.loc'] = 'left' and rc['title.loc'] = 'center'):

    Location

    Valid keys

    center above axes

    'center', 'c'

    left above axes

    'left', 'l'

    right above axes

    'right', 'r'

    lower center inside axes

    'lower center', 'lc'

    upper center inside axes

    'upper center', 'uc'

    upper right inside axes

    'upper right', 'ur'

    upper left inside axes

    'upper left', 'ul'

    lower left inside axes

    'lower left', 'll'

    lower right inside axes

    'lower right', 'lr'

  • abcborder, titleborder (bool, optional) – Whether to draw a white border around titles and a-b-c labels positioned inside the axes. This can help them stand out on top of artists plotted inside the axes. Defaults are rc['abc.border'] = True and rc['title.border'] = True.

  • abcbbox, titlebbox (bool, optional) – Whether to draw a white bbox around titles and a-b-c labels positioned inside the axes. This can help them stand out on top of artists plotted inside the axes. Defaults are rc['abc.bbox'] = False and rc['title.bbox'] = False.

  • abc_kw, title_kw (dict-like, optional) – Additional settings used to update the a-b-c label and title with text.update().

  • titlepad (float, optional) – The padding for the inner and outer titles and a-b-c labels in arbitrary units (default is points). Default is rc['title.pad'] = 5.0.

  • titleabove (bool, optional) – Whether to try to put outer titles and a-b-c labels above panels, colorbars, or legends that are above the axes. Default is rc['title.above'] = True.

  • abctitlepad (float, optional) – The horizontal padding between the a-b-c label and title when they are in the same location. Default is rc['abc.titlepad'] = 4.0.

  • ltitle, ctitle, rtitle, ultitle, uctitle, urtitle, lltitle, lctitle, lrtitle (str, optional) – Additional titles in specific positions. This works as an alternative to the ax.format(title='Title', titleloc=loc) workflow and permits adding more than one title-like label to a single axes.

  • a, alpha, fc, facecolor, ec, edgecolor, lw, linewidth, ls, linestyle (optional) – Additional settings applied to the background patch, and their shorthands. Defaults are rc['axes.alpha'], rc['axes.facecolor'], rc['axes.edgecolor'], rc['axes.linewidth'], and '-', respectively.

Other Parameters
  • rowlabels, collabels, llabels, tlabels, rlabels, blabels – Aliases for leftlabels and toplabels, and for leftlabels, toplabels, rightlabels, and bottomlabels, respectively.

  • leftlabels, toplabels, rightlabels, bottomlabels (sequence of str, optional) – Labels for the subplots lying along the left, top, right, and bottom edges of the figure. The length of each list must match the number of subplots along the corresponding edge.

  • leftlabelpad, toplabelpad, rightlabelpad, bottomlabelpad (float, optional) – The padding between the labels and the axes content in arbitrary units (default is points). Defaults are rc['leftlabel.pad'], rc['toplabel.pad'], rc['rightlabel.pad'], and rc['bottomlabel.pad']

  • leftlabels_kw, toplabels_kw, rightlabels_kw, bottomlabels_kw (dict-like, optional) – Additional settings used to update the labels with text.update().

  • figtitle – Alias for suptitle.

  • suptitle (str, optional) – The figure “super” title, centered between the left edge of the lefmost column of subplots and the right edge of the rightmost column of subplots, and automatically offset above figure titles. This is an improvement on matplotlib’s “super” title, which just centers the text between figure edges.

  • suptitlepad (float, optional) – The padding between the super title and the axes content in arbitrary units (default is points). Default is rc['suptitle.pad'].

  • suptitle_kw (optional) – Additional settings used to update the super title with text.update().

  • rc_mode (int, optional) – The context mode passed to context.

  • rc_kw (dict-like, optional) – An alternative to passing extra keyword arguments. See below.

  • **kwargs – Passed to proplot.config.Configurator.context and used to update the axes-relevant rc settings. For example, abcstyle='A.' modifies the rc['abc.style'] setting, titleloc='left' modifies the rc['title.loc'] setting, gridminor=True modifies the rc.gridminor setting, and gridbelow=True modifies the rc['grid.below'] setting. Many of the keyword arguments documented above are actually applied by updating the rc settings then retrieving the updated settings.

Important

abc, abcstyle, abcloc, titleloc, titleabove, titlepad, and abctitlepad are actually configuration settings. We explicitly document these arguments here because it is common to change them for specific axes. But many other configuration settings can be passed to format too.

get_tightbbox(renderer, *args, **kwargs)[source]

Return the tight bounding box of the axes, including axis and their decorators (xlabel, title, etc).

Artists that have artist.set_in_layout(False) are not included in the bbox.

Parameters
  • renderer (RendererBase instance) – renderer that will be used to draw the figures (i.e. fig.canvas.get_renderer())

  • bbox_extra_artists (list of Artist or None) – List of artists to include in the tight bounding box. If None (default), then all artist children of the axes are included in the tight bounding box.

  • call_axes_locator (boolean (default ``True`)`) – If call_axes_locator is False, it does not call the _axes_locator attribute, which is necessary to get the correct bounding box. call_axes_locator=False can be used if the caller is only interested in the relative size of the tightbbox compared to the axes bbox.

Returns

bbox (BboxBase) – bounding box in figure pixel coordinates.

indicate_inset_zoom(**kwargs)[source]

Draw lines indicating the zoom range of the inset axes. Must be called from the inset axes rather than the parent axes. This is similar to matplotlib.axes.Axes.indicate_inset_zoom except line positions are refreshed at drawtime. This is called automatically when zoom=True is passed to inset_axes.

Parameters
  • alpha (float, optional) – The transparency of the zoom box fill.

  • lw, linewidth (float, optional) – The width of the zoom lines and box outline in points.

  • ls, linestyle (linestyle-spec, optional) – The line style for the zoom lines and box outline.

  • ec, edgecolor (color-spec, optional) – The color of the zoom lines and box outline.

  • cs, capstyle ({'butt', 'round', 'projecting'}) – The cap style for the zoom lines and box outline.

  • zorder (float, optional) – The zorder of the zoom lines. Should be greater than the zorder of elements in the parent axes. Default is 3.5.

Other Parameters

**kwargs – Passed to indicate_inset.

inset(*args, **kwargs)[source]

Add an inset axes. This is similar to matplotlib.axes.Axes.inset_axes.

Parameters
  • bounds (4-tuple of float) – The (left, bottom, width, height) coordinates for the axes.

  • transform ({'data', 'axes', 'figure'} or Transform, optional) – The transform used to interpret the bounds. Can be a Transform instance or a string representing the transData, transAxes, or transFigure transforms. Default is 'axes', i.e. bounds is in axes-relative coordinates. Default is to use the same projection as the current axes.

  • 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.

  • basemap (bool or dict-like, optional) – Whether to use Basemap or Projection for map projections. Default is rc.basemap = False.

  • zorder (float, optional) – The zorder of the axes, should be greater than the zorder of elements in the parent axes. Default is 4.

  • zoom (bool, optional) – Whether to draw lines indicating the inset zoom using indicate_inset_zoom. The lines will automatically adjust whenever the parent axes or inset axes limits are changed. Default is True.

  • zoom_kw (dict, optional) – Passed to indicate_inset_zoom.

Returns

proplot.axes.Axes – The inset axes.

Other Parameters

**kwargs – Passed to CartesianAxes.

inset_axes(bounds, transform=None, *, proj=None, projection=None, zoom=None, zoom_kw=None, zorder=4, **kwargs)[source]

Add an inset axes. This is similar to matplotlib.axes.Axes.inset_axes.

Parameters
  • bounds (4-tuple of float) – The (left, bottom, width, height) coordinates for the axes.

  • transform ({'data', 'axes', 'figure'} or Transform, optional) – The transform used to interpret the bounds. Can be a Transform instance or a string representing the transData, transAxes, or transFigure transforms. Default is 'axes', i.e. bounds is in axes-relative coordinates. Default is to use the same projection as the current axes.

  • 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.

  • basemap (bool or dict-like, optional) – Whether to use Basemap or Projection for map projections. Default is rc.basemap = False.

  • zorder (float, optional) – The zorder of the axes, should be greater than the zorder of elements in the parent axes. Default is 4.

  • zoom (bool, optional) – Whether to draw lines indicating the inset zoom using indicate_inset_zoom. The lines will automatically adjust whenever the parent axes or inset axes limits are changed. Default is True.

  • zoom_kw (dict, optional) – Passed to indicate_inset_zoom.

Returns

proplot.axes.Axes – The inset axes.

Other Parameters

**kwargs – Passed to CartesianAxes.

legend(handles=None, labels=None, *, loc=None, location=None, queue=False, **kwargs)[source]

Add an inset legend or outer legend along the edge of the axes.

Parameters
  • handles (list of artist, optional) – List of matplotlib artists, or a list of lists of artist instances (see the center keyword). If None, artists with valid labels are retrieved automatically. If the object is a ContourSet, the legend_elements method is used to pair the collection or contour set label with the central artist in the list (generally giving the central colormap color if the object is controlled with a colormap).

  • labels (list of str, optional) – A matching list of string labels or None placeholders, or a matching list of lists (see the center keyword). Wherever None appears in the list (or if no labels were passed at all), labels are retrieved by calling get_label on each Artist in the handle list. If a handle consists of a tuple group of artists, labels are inferred from the artists in the tuple. If there are multiple unique labels in the tuple group of artists, the tuple group is expanded into unique legend entries. Otherwise, the tuple group elements are drawn on top of eachother. For details on matplotlib’s legend handlers, including tuple groups, see the matplotlib legend guide.

  • loc, location (int or str, optional) – The legend location. Default is rc['legend.loc'] = 'best'. Valid location keys are shown in the below table.

    Location

    Valid keys

    outer left

    'left', 'l'

    outer right

    'right', 'r'

    outer bottom

    'bottom', 'b'

    outer top

    'top', 't'

    “best” inset

    'best', 'inset', 'i', 0

    upper right inset

    'upper right', 'ur', 1

    upper left inset

    'upper left', 'ul', 2

    lower left inset

    'lower left', 'll', 3

    lower right inset

    'lower right', 'lr', 4

    center left inset

    'center left', 'cl', 5

    center right inset

    'center right', 'cr', 6

    lower center inset

    'lower center', 'lc', 7

    upper center inset

    'upper center', 'uc', 8

    center inset

    'center', 'c', 9

    “filled”

    'fill'

  • width (unit-spec, optional) – For outer legends only. The space allocated for the legend box. This does nothing if the tight layout algorithm is active for the figure. If float, units are inches. If string, interpreted by units.

  • queue (bool, optional) – If True and loc is the same as an existing legend, the input arguments are added to a queue and this function returns None. This is used to “update” the same legend with successive ax.legend(...) calls. If False (the default) and loc is the same as an existing inset legend, the old legend is removed. If False and loc is an outer legend, the legends are stacked.

  • space (unit-spec, optional) – For outer legends only. The fixed space between the legend and the subplot edge. If float, units are em-widths. If string, interpreted by units. When the tight layout algorithm is active for the figure, this is adjusted automatically using pad. Otherwise, a suitable default is selected.

  • pad (unit-spec, optional) – For outer legends, this is the tight layout padding between the legend and the subplot. Default is rc['subplots.panelpad'] = 0.5. For inset legends, this is the fixed space between the axes edge and the legend. Default is rc['legend.borderaxespad'] = 0. If float, units are em-widths. If string, interpreted by units.

  • align ({'center', 'top', 't', 'bottom', 'b', 'left', 'l', 'right', 'r'}, optional) – For outer legends only. How to align the legend against the subplot edge. Default is 'center'. The values 'top' and 'bottom' are valid for left and right legends and 'left' and 'right' are valid for top and bottom legends. The default is always 'center'.

Other Parameters
  • frame, frameon (bool, optional) – Toggles the legend frame. For centered-row legends, a frame independent from matplotlib’s built-in legend frame is created.

  • ncol, ncols (int, optional) – The number of columns. ncols is an alias, added for consistency with subplots.

  • order ({'C', 'F'}, optional) – Whether legend handles are drawn in row-major ('C') or column-major ('F') order. Analagous to numpy.array ordering. Default is 'F'.

  • center (bool, optional) – Whether to center each legend row individually. If True, we draw successive single-row legends stacked on top of each other. If None, we infer this setting from handles. By default, center is set to True if handles is a list of lists (each sublist is used as a row in the legend).

  • alphabetize (bool, optional) – Whether to alphabetize the legend entries according to the legend labels. Default is False.

  • title, label (str, optional) – The legend title. The label keyword is also accepted, for consistency with colorbar.

  • fontsize, fontweight, fontcolor (optional) – The font size, weight, and color for the legend text. Font size is interpreted by units. The default font size is rc['legend.fontsize'].

  • titlefontsize, titlefontweight, titlefontcolor (optional) – The font size, weight, and color for the legend title. Font size is interpreted by units. The default size is fontsize.

  • borderpad, borderaxespad, handlelength, handleheight, handletextpad, labelspacing, columnspacing (unit-spec, optional) – Various matplotlib legend spacing arguments. If float, units are em-widths. If string, interpreted by units.

  • a, alpha, framealpha, fc, facecolor, framecolor, ec, edgecolor, ew, edgewidth (optional) – The opacity, face color, edge color, and edge width for the legend frame. Defaults are rc['legend.framealpha'] = 0.8, rc['legend.facecolor'] = 'white', rc['legend.edgecolor'] = 'black' and rc['axes.linewidth'] = 0.6.

  • c, color, lw, linewidth, m, marker, ls, linestyle, dashes, ms, markersize (optional) – Properties used to override the legend handles. For example, for a legend describing variations in line style ignoring variations in color, you might want to use color='black'.

  • handle_kw (dict-like, optional) – Additional properties used to override legend handles, e.g. handle_kw={'edgecolor': 'black'}. Only line properties can be passed as keyword arguments.

  • handler_map (dict-like, optional) – A dictionary mapping instances or types to a legend handler. This handler_map updates the default handler map found at matplotlib.legend.Legend.get_legend_handler_map.

  • **kwargs – Passed to legend.

panel(*args, **kwargs)[source]

Add a panel along the edge of the axes.

Parameters
  • side (str, optional) – The panel location. Valid location keys are as follows.

    Location

    Valid keys

    left

    'left', 'l'

    right

    'right', 'r'

    bottom

    'bottom', 'b'

    top

    'top', 't'

  • width (unit-spec, optional) – The panel width. Default is rc['subplots.panelwidth'] = 0.5. If float, units are inches. If string, interpreted by units.

  • space (unit-spec, optional) – The fixed space between the panel and the subplot edge. If float, units are em-widths. If string, interpreted by units. When the tight layout algorithm is active for the figure, this is adjusted automatically using pad. Otherwise, a suitable default is selected.

  • pad (unit-spec, optional) – The tight layout padding between the panel and the subplot. If float, units are em-widths. If string, interpreted by units.

  • share (bool, optional) – Whether to enable axis sharing between the x and y axes of the main subplot and the panel long axes for each panel in the stack. Sharing between the panel short axis and other panel short axes is determined by figure-wide sharex and sharey settings.

Returns

proplot.axes.CartesianAxes – The panel axes.

panel_axes(*args, **kwargs)[source]

Add a panel along the edge of the axes.

Parameters
  • side (str, optional) – The panel location. Valid location keys are as follows.

    Location

    Valid keys

    left

    'left', 'l'

    right

    'right', 'r'

    bottom

    'bottom', 'b'

    top

    'top', 't'

  • width (unit-spec, optional) – The panel width. Default is rc['subplots.panelwidth'] = 0.5. If float, units are inches. If string, interpreted by units.

  • space (unit-spec, optional) – The fixed space between the panel and the subplot edge. If float, units are em-widths. If string, interpreted by units. When the tight layout algorithm is active for the figure, this is adjusted automatically using pad. Otherwise, a suitable default is selected.

  • pad (unit-spec, optional) – The tight layout padding between the panel and the subplot. If float, units are em-widths. If string, interpreted by units.

  • share (bool, optional) – Whether to enable axis sharing between the x and y axes of the main subplot and the panel long axes for each panel in the stack. Sharing between the panel short axis and other panel short axes is determined by figure-wide sharex and sharey settings.

Returns

proplot.axes.CartesianAxes – The panel axes.

text(*args, border=False, bordercolor='w', borderwidth=2, borderinvert=False, bbox=False, bboxcolor='w', bboxstyle='round', bboxalpha=0.5, bboxpad=None, fontfamily=None, family=None, fontname=None, name=None, fontsize=None, size=None, **kwargs)[source]

Add text to the axes.

Parameters
  • x, y, [z] (float) – The coordinates for the text

  • s (str) – The string for the text.

  • transform ({{'data', 'axes', 'figure'}} or Transform, optional) – The transform used to interpret x and y. This can be a Transform object or a string corresponding to transData, transAxes, or transFigure. Default is 'data', i.e. the text is positioned in data coordinates.

Other Parameters
  • border (bool, optional) – Whether to draw border around text.

  • borderwidth (float, optional) – The width of the text border. Default is 2 points.

  • bordercolor (color-spec, optional) – The color of the text border. Default is 'w'.

  • borderinvert (bool, optional) – If True, the text and border colors are swapped.

  • bbox (bool, optional) – Whether to draw a bounding box around text.

  • bboxcolor (color-spec, optional) – The color of the text bounding box. Default is 'w'.

  • bboxstyle (boxstyle, optional) – The style of the bounding box. Default is 'round'.

  • bboxalpha (float, optional) – The alpha for the bounding box. Default is '0.5'.

  • bboxpad (float, optional) – The padding for the bounding box. Default is rc['title.bboxpad'] = None.

  • name, fontname – Aliases for family, fontfamily.

  • family, fontfamily (str, optional) – The font typeface name (e.g., 'Fira Math') or font family name (e.g., 'serif'). Matplotlib falls back to the system default if not found.

  • size, fontsize (unit-spec or str, optional) – The font size. If float, units are points. If string, interpreted by units. This can also be a string indicating some scaling relative to rc['font.size']. The sizes and scalings are shown below. The scalings 'med', 'med-small', and 'med-large' are added by ProPlot while the rest are native matplotlib sizes.

    Size

    Scale

    'xx-small'

    0.579

    'x-small'

    0.694

    'small', 'smaller'

    0.833

    'med-small'

    0.9

    'med', 'medium'

    1.0

    'med-large'

    1.1

    'large', 'larger'

    1.2

    'x-large'

    1.440

    'xx-large'

    1.728

    'larger'

    1.2

  • **kwargs – Passed to matplotlib.axes.Axes.text.