CartesianAxes¶
- class CartesianAxes(*args, **kwargs)[source]¶
Bases:
proplot.axes.shared._SharedAxes
,proplot.axes.plot.PlotAxes
Axes subclass for plotting in ordinary Cartesian coordinates. Adds the
format
method and overrides several existing methods.Important
This is the default axes subclass. It can be specified explicitly by passing
proj='cart'
,proj='cartesian'
,proj='rect'
, orproj='rectilinear'
to axes-creation commands likeadd_axes
,add_subplot
, andsubplots
.- Parameters
aspect (
{'auto', 'equal'}
orfloat
, optional) – The data aspect ratio. Seeset_aspect
for details.xlabel, ylabel (
str
, optional) – The x and y axis labels. Applied withset_xlabel
andset_ylabel
.xlabelpad, ylabelpad (
unit-spec
, optional) – The padding between the x and y axis bounding box and the x and y axis labels. Default isrc['label.pad']
=4.0
. If float, units are points. If string, interpreted byunits
.xlabel_kw, ylabel_kw (dict-like, optional) – Additional settings used to update the axis labels with
text.update()
.xlim, ylim (
2-tuple
offloats
orNone
, optional) – The x and y axis data limits. Applied withset_xlim
andset_ylim
.xmin, ymin (
float
, optional) – The x and y minimum data limits. Useful if you do not want to set the maximum limits.xmax, ymax (
float
, optional) – The x and y maximum data limits. Useful if you do not want to set the minimum limits.xreverse, yreverse (
bool
, optional) – Whether to “reverse” the x and y axis direction. Makes the x and y axes ascend left-to-right and top-to-bottom, respectively.xscale, yscale (
scale-spec
, optional) – The x and y axis scales. Passed to theScale
constructor. For example,xscale='log'
applies logarithmic scaling, andxscale=('cutoff', 100, 2)
applies aCutoffScale
.xscale_kw, yscale_kw (dict-like, optional) – The x and y axis scale settings. Passed to
Scale
.xloc, yloc (optional) – Shorthands for
xspineloc
,yspineloc
.xspineloc, yspineloc (
{'bottom', 'top', 'left', 'right', 'both', 'neither', 'none', 'zero', 'center'}
or2-tuple
, optional) – The x and y spine locations. Applied withset_position
. Propagates totickloc
unless specified otherwise.xtickloc, ytickloc (
{'bottom', 'top', 'left', 'right', 'both', 'neither', 'none'}
, optional) – Which x and y axis spines should have major and minor tick marks. Inherits fromspineloc
by default and propagates toticklabelloc
unless specified otherwise.xticklabelloc, yticklabelloc (
{'bottom', 'top', 'left', 'right', 'both', 'neither', 'none'}
, optional) – Which x and y axis spines should have major tick labels. Inherits fromtickloc
by default and propagates tolabelloc
andoffsetloc
unless specified otherwise.xlabelloc, ylabelloc (
{'bottom', 'top', 'left', 'right'}
, optional) – Which x and y axis spines should have axis labels. Inherits fromticklabelloc
by default (ifticklabelloc
is a single side).xoffsetloc, yoffsetloc (
{'left', 'right'}
, optional) – Which x and y axis spines should have the axis offset indicator. Inherits fromticklabelloc
by default (ifticklabelloc
is a single side).xtickdir, ytickdir, tickdir (
{'out', 'in', 'inout'}
) – Direction that major and minor tick marks point for the x and y axis. Default isrc['tick.dir']
='out'
. Usetickdir
to control both.xticklabeldir, yticklabeldir (
{'in', 'out'}
) – Whether to place x and y axis tick label text inside or outside the axes.xticklabelpad, yticklabelpad (
unit-spec
, optional) – The padding between the x and y axis ticks and tick labels. Default isrc['tick.labelpad']
. If float, units are points. If string, interpreted byunits
.xgrid, ygrid, grid (
bool
, optional) – Whether to draw major gridlines on the x and y axis. Usegrid
to toggle both.xgridminor, ygridminor, gridminor (
bool
, optional) – Whether to draw minor gridlines for the x and y axis. Usegridminor
to toggle both.xtickminor, ytickminor, tickminor (
bool
, optional) – Whether to draw minor ticks on the x and y axes. Usetickminor
to toggle both.xticks, yticks (optional) – Aliases for
xlocator
,ylocator
.xlocator, ylocator (
locator-spec
, optional) – Used to determine the x and y axis tick mark positions. Passed to theLocator
constructor. Can be float, list of float, string, ormatplotlib.ticker.Locator
instance. Use[]
,'null'
, or'none'
for no ticks.xlocator_kw, ylocator_kw (dict-like, optional) – Keyword arguments passed to the
matplotlib.ticker.Locator
class.xminorticks, yminorticks (optional) – Aliases for
xminorlocator
,yminorlocator
.xminorlocator, yminorlocator (optional) – As for
xlocator
,ylocator
, but for the minor ticks.xminorlocator_kw, yminorlocator_kw – As for
xlocator_kw
,ylocator_kw
, but for the minor locator.xticklabels, yticklabels (optional) – Aliases for
xformatter
,yformatter
.xformatter, yformatter (
formatter-spec
, optional) – Used to determine the x and y axis tick label string format. Passed to theFormatter
constructor. Can be string, list of strings, ormatplotlib.ticker.Formatter
instance. Use[]
,'null'
, or'none'
for no labels.xformatter_kw, yformatter_kw (dict-like, optional) – Keyword arguments passed to the
matplotlib.ticker.Formatter
class.xrotation, yrotation (
float
, optional) – The rotation for x and y axis tick labels. Default is0
for normal axes,rc['formatter.timerotation']
='vertical'
for time x axes.xbounds, ybounds (
2-tuple
offloat
, optional) – The x and y axis data bounds within which to draw the spines. For example, the axis range(0, 4)
with bounds(1, 4)
will prevent the spines from meeting at the origin.xtickrange, ytickrange (
2-tuple
offloat
, optional) – The x and y axis data ranges within which major tick marks are labelled. For example, the tick range(-1, 1)
with axis range(-5, 5)
and a tick interval of 1 will only label the ticks marks at -1, 0, and 1. SeeAutoFormatter
for details.xwraprange, ywraprange (
2-tuple
offloat
, optional) – The x and y axis data ranges with which major tick mark values are wrapped. For example, the wrap range(0, 3)
causes the values 0 through 9 to be formatted as 0, 1, 2, 0, 1, 2, 0, 1, 2, 0. SeeAutoFormatter
for details.xmargin, ymargin, margin (
float
, optional) – The default margin between plotted content and the x and y axis spines. Value is proportional to the width, height of the axes. Use this to add whitespace between plotted content and axes edges without explicitly settingxlim
orylim
. Usemargin
to set both at once.xticklen, yticklen, ticklen (
unit-spec
, optional) – Major tick lengths for the x and y axis. Default isrc['tick.len']
=4.0
. If float, units are points. If string, interpreted byunits
. Useticklen
to set both at once.xticklenratio, yticklenratio, ticklenratio (
float
, optional) – Relative scaling ofxticklen
andyticklen
used to determine minor tick lengths. Default isrc['tick.lenratio']
=0.5
. Useticklenratio
to set both at once.xlinewidth, ylinewidth, linewidth (
color-spec
, optional) – Line width for the x and y axis spines and major ticks. Propagates totickwidth
unless specified otherwise. Uselinewidth
to set both at once.xtickwidth, ytickwidth, tickwidth, (
unit-spec
, optional) – Major tick widths for the x ans y axis. Default islinewidth
orrc['tick.width']
=0.6
iflinewidth
was not passed. If float, units are points. If string, interpreted byunits
. Usetickwidth
to set both at once.xtickwidthratio, ytickwidthratio, tickwidthratio – Relative scaling of
xtickwidth
andytickwidth
used to determine minor tick widths. Default isrc['tick.widthratio']
=0.8
. Usetickwidthratio
to set both at once.xcolor, ycolor, color (
color-spec
, optional) – Color for the x and y axis spines, ticks, tick labels, and axis labels. Usecolor
to set both at once.xtickcolor, ytickcolor, tickcolor (
color-spec
, optional) – Color for the x and y axis ticks. Inherits fromcolor
by default. Usetickcolor
to set both at once.xticklabelcolor, yticklabelcolor, ticklabelcolor (
color-spec
, optional) – Color for the x and y tick labels. Inherits fromcolor
by default. Useticklabelcolor
to set both at once.xlabelcolor, ylabelcolor, labelcolor (
color-spec
, optional) – Color for the x and y axis labels. Inherits fromcolor
by default. Uselabelcolor
to set both at once.xgridcolor, ygridcolor, gridcolor (
color-spec
, optional) – Color for the x and y axis major and minor gridlines. Usegridcolor
to set both at once.fixticks (
bool
, optional) – Whether to always transform the tick locators to aFixedLocator
instance. Default isFalse
. If your axis ticks are doing weird things (for example, ticks drawn outside of the axis spine), try setting this toTrue
.*args, **kwargs – Passed to
proplot.axes.Axes
.
- Other Parameters
title (
str
, optional) – The axes title.abc (
bool
orstr
, optional) – The “a-b-c” subplot label style. Must contain the charactera
orA
, for example'a.'
, or'A'
. IfTrue
then the default style of'a'
is used. Thea
orA
is replaced with the alphabetic character matching thenumber
. Ifnumber
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 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']
=True
andrc['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']
=False
andrc['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) – Shorthands for the below keywords.lefttitle, centertitle, righttitle, upperlefttitle, uppercentertitle, upperrighttitle, lowerlefttitle, lowercentertitle, lowerrighttitle (
str
,optoinal
) – 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 for 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.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.context
and used to update the axes-relevantrc
settings. For example,abc='A.'
modifies therc.abc
setting,titleloc='left'
modifies therc['title.loc']
setting,gridminor=True
modifies therc.gridminor
setting, andgridbelow=True
modifies therc['grid.below']
setting. Many of the keyword arguments documented above are actually applied by updating therc
settings then retrieving the updated settings.
See also
CartesianAxes.format
,proplot.axes.Axes
,proplot.axes.PlotAxes
,proplot.figure.Figure.subplot
,proplot.figure.Figure.add_subplot
Methods Summary
altx
(**kwargs)Add an axes locked to the same location with a distinct x axis.
alty
(**kwargs)Add an axes locked to the same location with a distinct y axis.
dualx
(funcscale, **kwargs)Add an axes locked to the same location whose x axis denotes equivalent coordinates in alternate units.
dualy
(funcscale, **kwargs)Add an axes locked to the same location whose y axis denotes equivalent coordinates in alternate units.
format
()Modify axes limits, axis scales, axis labels, spine locations, tick locations, tick labels, and more.
twinx
()Add an axes locked to the same location with a distinct y axis.
twiny
()Add an axes locked to the same location with a distinct x axis.