Axes¶
- class Axes(*args, **kwargs)[source]¶
Bases:
matplotlib.axes._axes.AxesThe lowest-level
Axessubclass used by proplot. Implements basic universal features.- Parameters
*args, **kwargs – Passed to
Axes.
See also
matplotlib.axes.Axes,proplot.axes.PlotAxes,proplot.axes.CartesianAxes,proplot.axes.PolarAxes,proplot.axes.GeoAxesAttributes Summary
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
SubplotGridreturned byproplot.figure.Figure.subplotsandproplot.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 ofartist, sequence ofcolor-spec, orcolormap-spec) – There are four options here:A mappable object. Basically, any object with a
get_cmapmethod, like the objects returned bycontourfandpcolormesh.A sequence of matplotlib artists. Any object with a
get_colormethod will do, likeLine2Dinstances. A colormap will be generated from the colors of these objects, and colorbar levels will be selected usingvalues. IfvaluesisNone, we try to infer them by converting the handle labels returned byget_labeltofloat. Otherwise, it is set tonp.linspace(0, 1, len(mappable)).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. IfvaluesisNone, it is set tonp.linspace(0, 1, len(mappable)).A
Colormapinstance. In this case, a colorbar will be drawn using this colormap and with levels determined byvalues. IfvaluesisNone, it is set tonp.linspace(0, 1, cmap.N).
values (sequence of
floatorstr, optional) – Ignored ifmappableis a mappable object. This maps each color or plot handle in themappablelist 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 isrc['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',0upper right inset
'upper right','ur',1upper left inset
'upper left','ul',2lower left inset
'lower left','ll',3lower right inset
'lower right','lr',4“filled”
'fill'length (
floatorunit-spec, optional) – The colorbar length. For outer colorbars, default isrc['colorbar.length']=1.0and units are relative to the axes width or height. For inset colorbars, default isrc['colorbar.insetlength']=8.0and units are absolute. If float, units are em-widths. If string, interpreted byunits.shrink (
float, optional) – Alias forlength. This is included for consistency withmatplotlib.figure.Figure.colorbar.width (
unit-spec, optional) – The colorbar width. For outer colorbars, default isrc['colorbar.width']=0.2. If float, units are inches. If string, interpreted byunits. For inset colorbars, default isrc['colorbar.insetwidth']=1.2. If float, units are em-widths. If string, interpreted byunits.queue (
bool, optional) – IfTrueandlocis the same as an existing colorbar, the input arguments are added to a queue and this function returnsNone. This is used to “update” the same colorbar with successiveax.colorbar(...)calls. IfFalse(the default) andlocis the same as an existing inset colorbar, the old colorbar is removed. IfFalseandlocis 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 byunits. When the tight layout algorithm is active for the figure, this is adjusted automatically usingpad. 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 isrc['subplots.panelpad']=0.5. For inset colorbars, this is the fixed space between the axes edge and the colorbar. Default isrc['colorbar.insetpad']=0.7. If float, units are em-widths. If string, interpreted byunits.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 iflengthis1.
- 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. IfNone, we try to use theextendattribute 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 matplotlibcolorbarkeyword.extendsize (
unit-spec, optional) – The length of the colorbar “extensions” in physical units. Default isrc['colorbar.insetextend']=0.9for inset colorbars andrc['colorbar.extend']=1.3for outer colorbars. If float, units are em-widths. If string, interpreted byunits.norm (
norm-spec, optional) – Ignored ifvaluesisNone. The normalizer for convertingvaluesto colormap colors. Passed toNorm.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 usingminorticks_on.label, title (
str, optional) – The colorbar label. Thetitlekeyword is also accepted for consistency withlegend.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 theLocatorconstructor function.locator_kw (dict-like, optional) – The locator settings. Passed to
Locator.minorlocator, minorticks – As with
locator,ticksbut for the minor ticks.minorlocator_kw – As with
locator_kw, but for the minor ticks.maxn (
int, optional) – Used iflocatorisNone. Determines the maximum number of levels that are ticked. Default depends on the colorbar length relative to the font size. The namemaxnis meant to be reminiscent ofMaxNLocator.maxn_minor – As with
maxn, but for the minor ticks.format, formatter, ticklabels (
formatter-spec, optional) – The tick label format. Passed to theFormatterconstructor function.formatter_kw (dict-like, optional) – The formatter settings. Passed to
Formatter.rotation (
float, optional) – The tick label rotation. Default is0.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 isrc['colorbar.grid']=False.frame, frameon (
bool, optional) – For inset colorbars only. Indicates whether to draw a “frame”, just likelegend. Default isrc['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.8andrc['colorbar.framecolor'].lw, linewidth, c, color (optional) – Controls the line width and edge color for both the colorbar outline and the level dividers.
edgefix (
boolorfloat, 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 isrc.edgefix=True. IfTrue, 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 isTruebut we change this torc['colorbar.rasterize']because rasterization can cause misalignment betweenedgesand 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.
- 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 (
boolorstr, optional) – The “a-b-c” subplot label style. Must contain the characteraorA, for example'a.', or'A'. IfTruethen the default style of'a'is used. TheaorAis replaced with the alphabetic character matching thenumber. Ifnumberis 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 arerc['abc.loc']='left'andrc['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 arerc['abc.border']=Trueandrc['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 arerc['abc.bbox']=Falseandrc['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 isrc['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 isrc['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 isrc['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 theax.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
leftlabelsandtoplabels, and forleftlabels,toplabels,rightlabels, andbottomlabels, 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 arerc['leftlabel.pad'],rc['toplabel.pad'],rc['rightlabel.pad'], andrc['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 isrc['suptitle.pad'].suptitle_kw (optional) – Additional settings used to update the super title with
text.update().rc_mode (
int, optional) – The context mode passed tocontext.rc_kw (dict-like, optional) – An alternative to passing extra keyword arguments. See below.
**kwargs – Passed to
proplot.config.Configurator.contextand used to update the axes-relevantrcsettings. For example,abcstyle='A.'modifies therc['abc.style']setting,titleloc='left'modifies therc['title.loc']setting,gridminor=Truemodifies therc.gridminorsetting, andgridbelow=Truemodifies therc['grid.below']setting. Many of the keyword arguments documented above are actually applied by updating thercsettings then retrieving the updated settings.
Important
abc,abcstyle,abcloc,titleloc,titleabove,titlepad, andabctitlepadare 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 toformattoo.
- 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 (
RendererBaseinstance) – renderer that will be used to draw the figures (i.e.fig.canvas.get_renderer())bbox_extra_artists (
listofArtistorNone) – List of artists to include in the tight bounding box. IfNone(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 isFalse, it does not call the_axes_locatorattribute, which is necessary to get the correct bounding box.call_axes_locator=Falsecan 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_zoomexcept line positions are refreshed at drawtime. This is called automatically whenzoom=Trueis passed toinset_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 is3.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-tupleoffloat) – The (left, bottom, width, height) coordinates for the axes.transform (
{'data', 'axes', 'figure'}orTransform, optional) – The transform used to interpret the bounds. Can be aTransforminstance or a string representing thetransData,transAxes, ortransFiguretransforms. Default is'axes', i.e.boundsis in axes-relative coordinates. Default is to use the same projection as the current axes.proj, projection (
str,cartopy.crs.Projection, orBasemap, optional) – The map projection specification(s). If'cart'or'cartesian'(the default), aCartesianAxesis created. If'polar', aPolarAxesis created. Otherwise, the argument is interpreted byProj, and the result is used to make aGeoAxes(in this case the argument can be acartopy.crs.Projectioninstance, aBasemapinstance, or a projection name listed in this table).proj_kw, projection_kw (dict-like, optional) – Keyword arguments passed to
Basemapor cartopyProjectionclasses on instantiation.basemap (
boolor dict-like, optional) – Whether to useBasemaporProjectionfor map projections. Default isrc.basemap=False.zorder (
float, optional) – The zorder of the axes, should be greater than the zorder of elements in the parent axes. Default is4.zoom (
bool, optional) – Whether to draw lines indicating the inset zoom usingindicate_inset_zoom. The lines will automatically adjust whenever the parent axes or inset axes limits are changed. Default isTrue.zoom_kw (
dict, optional) – Passed toindicate_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-tupleoffloat) – The (left, bottom, width, height) coordinates for the axes.transform (
{'data', 'axes', 'figure'}orTransform, optional) – The transform used to interpret the bounds. Can be aTransforminstance or a string representing thetransData,transAxes, ortransFiguretransforms. Default is'axes', i.e.boundsis in axes-relative coordinates. Default is to use the same projection as the current axes.proj, projection (
str,cartopy.crs.Projection, orBasemap, optional) – The map projection specification(s). If'cart'or'cartesian'(the default), aCartesianAxesis created. If'polar', aPolarAxesis created. Otherwise, the argument is interpreted byProj, and the result is used to make aGeoAxes(in this case the argument can be acartopy.crs.Projectioninstance, aBasemapinstance, or a projection name listed in this table).proj_kw, projection_kw (dict-like, optional) – Keyword arguments passed to
Basemapor cartopyProjectionclasses on instantiation.basemap (
boolor dict-like, optional) – Whether to useBasemaporProjectionfor map projections. Default isrc.basemap=False.zorder (
float, optional) – The zorder of the axes, should be greater than the zorder of elements in the parent axes. Default is4.zoom (
bool, optional) – Whether to draw lines indicating the inset zoom usingindicate_inset_zoom. The lines will automatically adjust whenever the parent axes or inset axes limits are changed. Default isTrue.zoom_kw (
dict, optional) – Passed toindicate_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 (
listofartist, optional) – List of matplotlib artists, or a list of lists of artist instances (see thecenterkeyword). IfNone, artists with valid labels are retrieved automatically. If the object is aContourSet, thelegend_elementsmethod 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 (
listofstr, optional) – A matching list of string labels orNoneplaceholders, or a matching list of lists (see thecenterkeyword). WhereverNoneappears in the list (or if no labels were passed at all), labels are retrieved by callingget_labelon eachArtistin 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 (
intorstr, optional) – The legend location. Default isrc['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',0upper right inset
'upper right','ur',1upper left inset
'upper left','ul',2lower left inset
'lower left','ll',3lower right inset
'lower right','lr',4center left inset
'center left','cl',5center right inset
'center right','cr',6lower center inset
'lower center','lc',7upper center inset
'upper center','uc',8center 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 byunits.queue (
bool, optional) – IfTrueandlocis the same as an existing legend, the input arguments are added to a queue and this function returnsNone. This is used to “update” the same legend with successiveax.legend(...)calls. IfFalse(the default) andlocis the same as an existing inset legend, the old legend is removed. IfFalseandlocis 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 byunits. When the tight layout algorithm is active for the figure, this is adjusted automatically usingpad. 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 isrc['subplots.panelpad']=0.5. For inset legends, this is the fixed space between the axes edge and the legend. Default isrc['legend.borderaxespad']=0. If float, units are em-widths. If string, interpreted byunits.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.ncolsis an alias, added for consistency withsubplots.order (
{'C', 'F'}, optional) – Whether legend handles are drawn in row-major ('C') or column-major ('F') order. Analagous tonumpy.arrayordering. Default is'F'.center (
bool, optional) – Whether to center each legend row individually. IfTrue, we draw successive single-row legends stacked on top of each other. IfNone, we infer this setting fromhandles. By default,centeris set toTrueifhandlesis 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 isFalse.title, label (
str, optional) – The legend title. Thelabelkeyword is also accepted, for consistency withcolorbar.fontsize, fontweight, fontcolor (optional) – The font size, weight, and color for the legend text. Font size is interpreted by
units. The default font size isrc['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 isfontsize.borderpad, borderaxespad, handlelength, handleheight, handletextpad, labelspacing, columnspacing (
unit-spec, optional) – Various matplotliblegendspacing arguments. If float, units are em-widths. If string, interpreted byunits.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'andrc['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_mapupdates the default handler map found atmatplotlib.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 isrc['subplots.panelwidth']=0.5. If float, units are inches. If string, interpreted byunits.space (
unit-spec, optional) – The fixed space between the panel and the subplot edge. If float, units are em-widths. If string, interpreted byunits. When the tight layout algorithm is active for the figure, this is adjusted automatically usingpad. 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 byunits.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-widesharexandshareysettings.
- 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 isrc['subplots.panelwidth']=0.5. If float, units are inches. If string, interpreted byunits.space (
unit-spec, optional) – The fixed space between the panel and the subplot edge. If float, units are em-widths. If string, interpreted byunits. When the tight layout algorithm is active for the figure, this is adjusted automatically usingpad. 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 byunits.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-widesharexandshareysettings.
- 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 texts (
str) – The string for the text.transform (
{{'data', 'axes', 'figure'}}orTransform, optional) – The transform used to interpretxandy. This can be aTransformobject or a string corresponding totransData,transAxes, ortransFigure. 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 is2points.bordercolor (
color-spec, optional) – The color of the text border. Default is'w'.borderinvert (
bool, optional) – IfTrue, 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 isrc['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-specorstr, optional) – The font size. If float, units are points. If string, interpreted byunits. This can also be a string indicating some scaling relative torc['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.
See also