PolarAxes
- class PolarAxes(*args, **kwargs)[source]
Bases:
_SharedAxes,PlotAxes,PolarAxesAxes subclass for plotting in polar coordinates. Adds the
formatmethod and overrides several existing methods.Important
This axes subclass can be used by passing
proj='polar'to axes-creation commands likeadd_axes,add_subplot, andsubplots.- Parameters:
*args – Passed to
matplotlib.axes.Axes.r0 (
float, default:0) – The radial origin.theta0 (
{'N', 'NW', 'W', 'SW', 'S', 'SE', 'E', 'NE'}, optional) – The zero azimuth location.thetadir (
{1, -1, 'anticlockwise', 'counterclockwise', 'clockwise'}, optional) – The positive azimuth direction. Clockwise corresponds to-1and anticlockwise corresponds to1.thetamin, thetamax (
float, optional) – The lower and upper azimuthal bounds in degrees. Ifthetamax != thetamin + 360, this produces a sector plot.thetalim (
2-tupleoffloatorNone, optional) – Specifiesthetaminandthetamaxat once.rmin, rmax (
float, optional) – The inner and outer radial limits. Ifr0 != rmin, this produces an annular plot.rlim (
2-tupleoffloatorNone, optional) – Specifiesrminandrmaxat once.rborder (
bool, optional) – Whether to draw the polar axes border. Visibility of the “inner” radial spine and “start” and “end” azimuthal spines is controlled automatically by matplotlib.thetagrid, rgrid, grid (
bool, optional) – Whether to draw major gridlines for the azimuthal and radial axis. Use the keywordgridto toggle both.thetagridminor, rgridminor, gridminor (
bool, optional) – Whether to draw minor gridlines for the azimuthal and radial axis. Use the keywordgridminorto toggle both.thetagridcolor, rgridcolor, gridcolor (
color-spec, optional) – Color for the major and minor azimuthal and radial gridlines. Use the keywordgridcolorto set both at once.thetalocator, rlocator (
locator-spec, optional) – Used to determine the azimuthal and radial gridline positions. Passed to theLocatorconstructor. Can be float, list of float, string, ormatplotlib.ticker.Locatorinstance.thetalines, rlines – Aliases for
thetalocator,rlocator.thetalocator_kw, rlocator_kw (dict-like, optional) – The azimuthal and radial locator settings. Passed to
Locator.thetaminorlocator, rminorlocator (optional) – As for
thetalocator,rlocator, but for the minor gridlines.thetaminorticks, rminorticks (optional) – Aliases for
thetaminorlocator,rminorlocator.thetaminorlocator_kw, rminorlocator_kw – As for
thetalocator_kw,rlocator_kw, but for the minor locator.rlabelpos (
float, optional) – The azimuth at which radial coordinates are labeled.thetaformatter, rformatter (
formatter-spec, optional) – Used to determine the azimuthal and radial label format. Passed to theFormatterconstructor. Can be string, list of string, ormatplotlib.ticker.Formatterinstance. Use[],'null', or'none'for no labels.thetalabels, rlabels (optional) – Aliases for
thetaformatter,rformatter.thetaformatter_kw, rformatter_kw (dict-like, optional) – The azimuthal and radial label formatter settings. Passed to
Formatter.color (
color-spec, default:rc['meta.color']='black') – Color for the axes edge. Propagates tolabelcolorunless specified otherwise (similar toformat()).labelcolor, gridlabelcolor (
color-spec, default:colororrc['grid.labelcolor']='black') – Color for the gridline labels.labelpad, gridlabelpad (
unit-spec, default:rc['grid.labelpad']=3.0) – The padding between the axes edge and the radial and azimuthal labels. If float, units are points. If string, interpreted byunits.labelsize, gridlabelsize (
unit-specorstr, default:rc['grid.labelsize']='medium') – Font size for the gridline labels. If float, units are points. If string, interpreted byunits.labelweight, gridlabelweight (
str, default:rc['grid.labelweight']='normal') – Font weight for the gridline labels.
- Other Parameters:
title (
stror sequence, optional) – The axes title. Can optionally be a sequence strings, in which case the title will be selected from the sequence according tonumber.abc (
boolorstror sequence, default:rc.abc=False) – 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. Can also be a sequence of strings, in which case the “a-b-c” label will be selected sequentially from the list. For exampleaxs.format(abc = ["X", "Y"])for a two-panel figure, andaxes[3:5].format(abc = ["X", "Y"])for a two-panel subset of a larger figure.abcloc, titleloc (
str, default:rc['abc.loc']='left',rc['title.loc']='center') – Strings indicating the location for the a-b-c label and main title. The following locations are valid: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'left of y axis
'outer left','ol'right of y axis
'outer right','or'abcborder, titleborder (
bool, default:rc['abc.border']=Trueandrc['title.border']=True) – 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.abcbbox, titlebbox (
bool, default:rc['abc.bbox']=Falseandrc['title.bbox']=False) – 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.abcpad (
floatorunit-spec, default:rc['abc.pad']) – Horizontal offset to shift the a-b-c label position. Positive values move the label right, negative values move it left. This is separate fromabctitlepad, which controls spacing between abc and title when co-located. If float, units are points. If string, interpreted byunits.abc_kw, title_kw (dict-like, optional) – Additional settings used to update the a-b-c label and title with
text.update().titlepad (
float, default:rc['title.pad']=5.0) – The padding for the inner and outer titles and a-b-c labels. If float, units are points. If string, interpreted byunits.titleabove (
bool, default:rc['title.above']=True) – Whether to try to put outer titles and a-b-c labels above panels, colorbars, or legends that are above the axes.abctitlepad (
float, default:rc['abc.titlepad']=4.0) – The horizontal padding between a-b-c labels and titles in the same location. If float, units are points. If string, interpreted byunits.ltitle, ctitle, rtitle, ultitle, uctitle, urtitle, lltitle, lctitle, lrtitle (
stror sequence, :py:class:`optional `) – Shorthands for the below keywords. lefttitle, centertitle, righttitle, upperlefttitle, uppercentertitle, upperrighttitle : str or sequence, optionallowerlefttitle, lowercentertitle, lowerrighttitle (
stror sequence, optional) – Additional titles in specific positions (seetitlefor details). 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 (**default* *) –
rc['axes.alpha']=None(default: 1.0),rc['axes.facecolor']='white'(default: white),rc['axes.edgecolor']='black'(default: black),rc['axes.linewidth']=0.6(default: 0.6), - Additional settings applied to the background patch, and their shorthands. Their defaults values are the'axes'properties.rc_mode (
int, optional) – The context mode passed tocontext.rc_kw (dict-like, optional) – An alternative to passing extra keyword arguments. See below.
**kwargs – Remaining keyword arguments are passed to
matplotlib.axes.Axes.n Keyword arguments that match the name of anrcsetting are passed toultraplot.config.Configurator.contextand used to update the axes. If the setting name has “dots” you can simply omit the dots. For example,abc='A.'modifies therc.abcsetting,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 internally applied by retrieving settings passed tocontext.
See also
PolarAxes.format,ultraplot.axes.Axes,ultraplot.axes.PlotAxes,matplotlib.projections.PolarAxes,ultraplot.figure.Figure.subplot,ultraplot.figure.Figure.add_subplotAttributes Summary
Methods Summary
format()Modify axes limits, radial and azimuthal gridlines, and more.
set(*[, adjustable, agg_filter, alpha, ...])Set multiple properties at once.
Attributes Documentation
- name = 'polar'
Methods Documentation
- format()[source]
Modify axes limits, radial and azimuthal gridlines, and more. Note that all of the
thetaarguments are specified in degrees, not radians.- Parameters:
r0 (
float, default:0) – The radial origin.theta0 (
{'N', 'NW', 'W', 'SW', 'S', 'SE', 'E', 'NE'}, optional) – The zero azimuth location.thetadir (
{1, -1, 'anticlockwise', 'counterclockwise', 'clockwise'}, optional) – The positive azimuth direction. Clockwise corresponds to-1and anticlockwise corresponds to1.thetamin, thetamax (
float, optional) – The lower and upper azimuthal bounds in degrees. Ifthetamax != thetamin + 360, this produces a sector plot.thetalim (
2-tupleoffloatorNone, optional) – Specifiesthetaminandthetamaxat once.rmin, rmax (
float, optional) – The inner and outer radial limits. Ifr0 != rmin, this produces an annular plot.rlim (
2-tupleoffloatorNone, optional) – Specifiesrminandrmaxat once.rborder (
bool, optional) – Whether to draw the polar axes border. Visibility of the “inner” radial spine and “start” and “end” azimuthal spines is controlled automatically by matplotlib.thetagrid, rgrid, grid (
bool, optional) – Whether to draw major gridlines for the azimuthal and radial axis. Use the keywordgridto toggle both.thetagridminor, rgridminor, gridminor (
bool, optional) – Whether to draw minor gridlines for the azimuthal and radial axis. Use the keywordgridminorto toggle both.thetagridcolor, rgridcolor, gridcolor (
color-spec, optional) – Color for the major and minor azimuthal and radial gridlines. Use the keywordgridcolorto set both at once.thetalocator, rlocator (
locator-spec, optional) – Used to determine the azimuthal and radial gridline positions. Passed to theLocatorconstructor. Can be float, list of float, string, ormatplotlib.ticker.Locatorinstance.thetalines, rlines – Aliases for
thetalocator,rlocator.thetalocator_kw, rlocator_kw (dict-like, optional) – The azimuthal and radial locator settings. Passed to
Locator.thetaminorlocator, rminorlocator (optional) – As for
thetalocator,rlocator, but for the minor gridlines.thetaminorticks, rminorticks (optional) – Aliases for
thetaminorlocator,rminorlocator.thetaminorlocator_kw, rminorlocator_kw – As for
thetalocator_kw,rlocator_kw, but for the minor locator.rlabelpos (
float, optional) – The azimuth at which radial coordinates are labeled.thetaformatter, rformatter (
formatter-spec, optional) – Used to determine the azimuthal and radial label format. Passed to theFormatterconstructor. Can be string, list of string, ormatplotlib.ticker.Formatterinstance. Use[],'null', or'none'for no labels.thetalabels, rlabels (optional) – Aliases for
thetaformatter,rformatter.thetaformatter_kw, rformatter_kw (dict-like, optional) – The azimuthal and radial label formatter settings. Passed to
Formatter.color (
color-spec, default:rc['meta.color']='black') – Color for the axes edge. Propagates tolabelcolorunless specified otherwise (similar toformat()).labelcolor, gridlabelcolor (
color-spec, default:colororrc['grid.labelcolor']='black') – Color for the gridline labels.labelpad, gridlabelpad (
unit-spec, default:rc['grid.labelpad']=3.0) – The padding between the axes edge and the radial and azimuthal labels. If float, units are points. If string, interpreted byunits.labelsize, gridlabelsize (
unit-specorstr, default:rc['grid.labelsize']='medium') – Font size for the gridline labels. If float, units are points. If string, interpreted byunits.labelweight, gridlabelweight (
str, default:rc['grid.labelweight']='normal') – Font weight for the gridline labels.
- Other Parameters:
title (
stror sequence, optional) – The axes title. Can optionally be a sequence strings, in which case the title will be selected from the sequence according tonumber.abc (
boolorstror sequence, default:rc.abc=False) – 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. Can also be a sequence of strings, in which case the “a-b-c” label will be selected sequentially from the list. For exampleaxs.format(abc = ["X", "Y"])for a two-panel figure, andaxes[3:5].format(abc = ["X", "Y"])for a two-panel subset of a larger figure.abcloc, titleloc (
str, default:rc['abc.loc']='left',rc['title.loc']='center') – Strings indicating the location for the a-b-c label and main title. The following locations are valid: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'left of y axis
'outer left','ol'right of y axis
'outer right','or'abcborder, titleborder (
bool, default:rc['abc.border']=Trueandrc['title.border']=True) – 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.abcbbox, titlebbox (
bool, default:rc['abc.bbox']=Falseandrc['title.bbox']=False) – 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.abcpad (
floatorunit-spec, default:rc['abc.pad']) – Horizontal offset to shift the a-b-c label position. Positive values move the label right, negative values move it left. This is separate fromabctitlepad, which controls spacing between abc and title when co-located. If float, units are points. If string, interpreted byunits.abc_kw, title_kw (dict-like, optional) – Additional settings used to update the a-b-c label and title with
text.update().titlepad (
float, default:rc['title.pad']=5.0) – The padding for the inner and outer titles and a-b-c labels. If float, units are points. If string, interpreted byunits.titleabove (
bool, default:rc['title.above']=True) – Whether to try to put outer titles and a-b-c labels above panels, colorbars, or legends that are above the axes.abctitlepad (
float, default:rc['abc.titlepad']=4.0) – The horizontal padding between a-b-c labels and titles in the same location. If float, units are points. If string, interpreted byunits.ltitle, ctitle, rtitle, ultitle, uctitle, urtitle, lltitle, lctitle, lrtitle (
stror sequence, :py:class:`optional `) – Shorthands for the below keywords. lefttitle, centertitle, righttitle, upperlefttitle, uppercentertitle, upperrighttitle : str or sequence, optionallowerlefttitle, lowercentertitle, lowerrighttitle (
stror sequence, optional) – Additional titles in specific positions (seetitlefor details). 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 (**default* *) –
rc['axes.alpha']=None(default: 1.0),rc['axes.facecolor']='white'(default: white),rc['axes.edgecolor']='black'(default: black),rc['axes.linewidth']=0.6(default: 0.6), - Additional settings applied to the background patch, and their shorthands. Their defaults values are the'axes'properties.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 (
floatorunit-spec, default )rc['leftlabel.pad']=5.0,rc['toplabel.pad']=5.0,rc['rightlabel.pad']=5.0,rc['bottomlabel.pad']=5.0– The padding between the labels and the axes content. If float, units are points. If string, interpreted byunits.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 leftmost subplot and the right edge of the rightmost subplot.suptitlepad (
float, default:rc['suptitle.pad']=5.0) – The padding between the super title and the axes content. If float, units are points. If string, interpreted byunits.suptitle_kw (optional) – Additional settings used to update the super title with
text.update().includepanels (
bool, default:False) – Whether to include panels when aligning figure “super titles” along the top of the subplot grid and when aligning thespanxx axis labels andspanyy axis labels along the sides of the subplot grid.rc_mode (
int, optional) – The context mode passed tocontext.rc_kw (dict-like, optional) – An alternative to passing extra keyword arguments. See below.
**kwargs – Keyword arguments that match the name of an
rcsetting are passed toultraplot.config.Configurator.contextand used to update the axes. If the setting name has “dots” you can simply omit the dots. For example,abc='A.'modifies therc.abcsetting,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 internally applied by retrieving settings passed tocontext.
- set(*, adjustable=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, anchor=<UNSET>, animated=<UNSET>, aspect=<UNSET>, autoscale_on=<UNSET>, autoscalex_on=<UNSET>, autoscaley_on=<UNSET>, axes_locator=<UNSET>, axisbelow=<UNSET>, box_aspect=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, external=<UNSET>, facecolor=<UNSET>, forward_navigation_events=<UNSET>, frame_on=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, navigate=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, prop_cycle=<UNSET>, rasterization_zorder=<UNSET>, rasterized=<UNSET>, rgrids=<UNSET>, rlabel_position=<UNSET>, rlim=<UNSET>, rmax=<UNSET>, rmin=<UNSET>, rorigin=<UNSET>, rscale=<UNSET>, rticks=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, subplotspec=<UNSET>, theta_direction=<UNSET>, theta_offset=<UNSET>, theta_zero_location=<UNSET>, thetagrids=<UNSET>, thetalim=<UNSET>, thetamax=<UNSET>, thetamin=<UNSET>, title=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xbound=<UNSET>, xlabel=<UNSET>, xlim=<UNSET>, xmargin=<UNSET>, xscale=<UNSET>, xticklabels=<UNSET>, xticks=<UNSET>, ybound=<UNSET>, ylabel=<UNSET>, ylim=<UNSET>, ymargin=<UNSET>, yscale=<UNSET>, yticklabels=<UNSET>, yticks=<UNSET>, zorder=<UNSET>)
Set multiple properties at once.
Supported properties are
Property
Description
{‘box’, ‘datalim’}
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
float or None
(float, float) or {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, …}
bool
{‘auto’, ‘equal’} or float
bool
unknown
unknown
Callable[[Axes, Renderer], Bbox]
bool or ‘line’
float or None
BboxBaseor Nonebool
Patch or (Path, Transform) or None
externalunknown
bool or “auto”
bool
str
bool
object
bool
bool
unknown
list of
AbstractPathEffectNone or bool or float or callable
[left, bottom, width, height] or
Bboxfloat or None
bool
tuple with floats
number
unknown
float
float
float
unknown
unknown
(scale: float, length: float, randomness: float)
bool or None
unknown
unknown
unknown
str
tuple with floats, degrees
unknown
unknown
unknown
str
str
bool
(lower: float, upper: float)
str
(left: float, right: float)
float greater than -0.5
unknown
unknown
unknown
(lower: float, upper: float)
str
(bottom: float, top: float)
float greater than -0.5
unknown
unknown
unknown
float