matplotlib.projections.polar#

classmatplotlib.projections.polar.InvertedPolarTransform(axis=None,use_rmin=True,*,apply_theta_transforms=True)[source]#

Bases:Transform

The inverse of the polar transform, mapping Cartesiancoordinate spacex andy back totheta andr.

Parameters:
axisAxis, optional

Axis associated with this transform. This is used to get theminimum radial limit.

use_rminbool, optional

IfTrue, add the minimum radial axis limit aftertransforming from Cartesian coordinates.axis must also bespecified for this to take effect.

has_inverse=True#

True if this transform has a corresponding inverse transform.

input_dims=2#

The number of input dimensions of this transform.Must be overridden (with integers) in the subclass.

inverted()[source]#

Return the corresponding inverse transformation.

It holdsx==self.inverted().transform(self.transform(x)).

The return value of this method should be treated astemporary. An update toself does not cause a correspondingupdate to its inverted copy.

output_dims=2#

The number of output dimensions of this transform.Must be overridden (with integers) in the subclass.

transform_non_affine(values)[source]#

Apply only the non-affine part of this transformation.

transform(values) is always equivalent totransform_affine(transform_non_affine(values)).

In non-affine transformations, this is generally equivalent totransform(values). In affine transformations, this isalways a no-op.

Parameters:
valuesarray

The input values as an array of lengthinput_dims orshape (N,input_dims).

Returns:
array

The output values as an array of lengthoutput_dims orshape (N,output_dims), depending on the input.

classmatplotlib.projections.polar.PolarAffine(scale_transform,limits)[source]#

Bases:Affine2DBase

The affine part of the polar projection.

Scales the output so that maximum radius rests on the edge of the Axescircle and the origin is mapped to (0.5, 0.5). The transform applied isthe same to x and y components and given by:

\[x_{1} = 0.5 \left [ \frac{x_{0}}{(r_{\max} - r_{\min})} + 1 \right ]\]

\(r_{\min}, r_{\max}\) are the minimum and maximum radial limits afterany scaling (e.g. log scaling) has been removed.

Parameters:
scale_transformTransform

Scaling transform for the data. This is used to remove any scalingfrom the radial view limits.

limitsBboxBase

View limits of the data. The only part of its bounds that is usedis the y limits (for the radius limits).

get_matrix()[source]#

Get the matrix for the affine part of this transform.

classmatplotlib.projections.polar.PolarAxes(*args,theta_offset=0,theta_direction=1,rlabel_position=22.5,**kwargs)[source]#

Bases:Axes

A polar graph projection, where the input dimensions aretheta,r.

Theta starts pointing east and goes anti-clockwise.

Build an Axes in a figure.

Parameters:
figFigure

The Axes is built in theFigurefig.

*args

*args can be a single(left,bottom,width,height)rectangle or a singleBbox. This specifies the rectangle (infigure coordinates) where the Axes is positioned.

*args can also consist of three numbers or a single three-digitnumber; in the latter case, the digits are considered asindependent numbers. The numbers are interpreted as(nrows,ncols,index):(nrows,ncols) specifies the size of an arrayof subplots, andindex is the 1-based index of the subplotbeing created. Finally,*args can also directly be aSubplotSpec instance.

sharex, shareyAxes, optional

The x- or y-axis is shared with the x- or y-axis inthe inputAxes. Note that it is not possible to unshareaxes.

frameonbool, default: True

Whether the Axes frame is visible.

box_aspectfloat, optional

Set a fixed aspect for the Axes box, i.e. the ratio of height towidth. Seeset_box_aspect for details.

forward_navigation_eventsbool or "auto", default: "auto"

Control whether pan/zoom events are passed through to Axes belowthis one. "auto" isTrue for axes with an invisible patch andFalse otherwise.

**kwargs

Other optional keyword arguments:

Property

Description

adjustable

{'box', 'datalim'}

agg_filter

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

alpha

float or None

anchor

(float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}

animated

bool

aspect

{'auto', 'equal'} or float

autoscale_on

bool

autoscalex_on

unknown

autoscaley_on

unknown

axes_locator

Callable[[Axes, Renderer], Bbox]

axisbelow

bool or 'line'

box_aspect

float or None

clip_box

BboxBase or None

clip_on

bool

clip_path

Patch or (Path, Transform) or None

facecolor orfc

color

figure

Figure orSubFigure

forward_navigation_events

bool or "auto"

frame_on

bool

gid

str

in_layout

bool

label

object

mouseover

bool

navigate

bool

navigate_mode

unknown

path_effects

list ofAbstractPathEffect

picker

None or bool or float or callable

position

[left, bottom, width, height] orBbox

prop_cycle

Cycler

rasterization_zorder

float or None

rasterized

bool

sketch_params

(scale: float, length: float, randomness: float)

snap

bool or None

subplotspec

unknown

title

str

transform

Transform

url

str

visible

bool

xbound

(lower: float, upper: float)

xlabel

str

xlim

(left: float, right: float)

xmargin

float greater than -0.5

xscale

unknown

xticklabels

unknown

xticks

unknown

ybound

(lower: float, upper: float)

ylabel

str

ylim

(bottom: float, top: float)

ymargin

float greater than -0.5

yscale

unknown

yticklabels

unknown

yticks

unknown

zorder

float

Returns:
Axes

The newAxes object.

classInvertedPolarTransform(axis=None,use_rmin=True,*,apply_theta_transforms=True)[source]#

Bases:Transform

The inverse of the polar transform, mapping Cartesiancoordinate spacex andy back totheta andr.

Parameters:
axisAxis, optional

Axis associated with this transform. This is used to get theminimum radial limit.

use_rminbool, optional

IfTrue, add the minimum radial axis limit aftertransforming from Cartesian coordinates.axis must also bespecified for this to take effect.

has_inverse=True#

True if this transform has a corresponding inverse transform.

input_dims=2#

The number of input dimensions of this transform.Must be overridden (with integers) in the subclass.

inverted()[source]#

Return the corresponding inverse transformation.

It holdsx==self.inverted().transform(self.transform(x)).

The return value of this method should be treated astemporary. An update toself does not cause a correspondingupdate to its inverted copy.

output_dims=2#

The number of output dimensions of this transform.Must be overridden (with integers) in the subclass.

transform_non_affine(values)[source]#

Apply only the non-affine part of this transformation.

transform(values) is always equivalent totransform_affine(transform_non_affine(values)).

In non-affine transformations, this is generally equivalent totransform(values). In affine transformations, this isalways a no-op.

Parameters:
valuesarray

The input values as an array of lengthinput_dims orshape (N,input_dims).

Returns:
array

The output values as an array of lengthoutput_dims orshape (N,output_dims), depending on the input.

classPolarAffine(scale_transform,limits)[source]#

Bases:Affine2DBase

The affine part of the polar projection.

Scales the output so that maximum radius rests on the edge of the Axescircle and the origin is mapped to (0.5, 0.5). The transform applied isthe same to x and y components and given by:

\[x_{1} = 0.5 \left [ \frac{x_{0}}{(r_{\max} - r_{\min})} + 1 \right ]\]

\(r_{\min}, r_{\max}\) are the minimum and maximum radial limits afterany scaling (e.g. log scaling) has been removed.

Parameters:
scale_transformTransform

Scaling transform for the data. This is used to remove any scalingfrom the radial view limits.

limitsBboxBase

View limits of the data. The only part of its bounds that is usedis the y limits (for the radius limits).

get_matrix()[source]#

Get the matrix for the affine part of this transform.

classPolarTransform(axis=None,use_rmin=True,*,apply_theta_transforms=True,scale_transform=None)[source]#

Bases:Transform

The base polar transform.

This transform maps polar coordinates\(\theta, r\) into Cartesiancoordinates\(x, y = r \cos(\theta), r \sin(\theta)\)(but does not fully transform into Axes coordinates orhandle positioning in screen space).

This transformation is designed to be applied to data after any scalingalong the radial axis (e.g. log-scaling) has been applied to the inputdata.

Path segments at a fixed radius are automatically transformed to circulararcs as long aspath._interpolation_steps>1.

Parameters:
axisAxis, optional

Axis associated with this transform. This is used to get theminimum radial limit.

use_rminbool, optional

IfTrue, subtract the minimum radial axis limit beforetransforming to Cartesian coordinates.axis must also bespecified for this to take effect.

has_inverse=True#

True if this transform has a corresponding inverse transform.

input_dims=2#

The number of input dimensions of this transform.Must be overridden (with integers) in the subclass.

inverted()[source]#

Return the corresponding inverse transformation.

It holdsx==self.inverted().transform(self.transform(x)).

The return value of this method should be treated astemporary. An update toself does not cause a correspondingupdate to its inverted copy.

output_dims=2#

The number of output dimensions of this transform.Must be overridden (with integers) in the subclass.

transform_non_affine(values)[source]#

Apply only the non-affine part of this transformation.

transform(values) is always equivalent totransform_affine(transform_non_affine(values)).

In non-affine transformations, this is generally equivalent totransform(values). In affine transformations, this isalways a no-op.

Parameters:
valuesarray

The input values as an array of lengthinput_dims orshape (N,input_dims).

Returns:
array

The output values as an array of lengthoutput_dims orshape (N,output_dims), depending on the input.

transform_path_non_affine(path)[source]#

Apply the non-affine part of this transform toPathpath,returning a newPath.

transform_path(path) is equivalent totransform_path_affine(transform_path_non_affine(values)).

classRadialLocator(base,axes=None)[source]#

Bases:Locator

Used to locate radius ticks.

Ensures that all ticks are strictly positive. For all other tasks, itdelegates to the baseLocator (which may be different depending on thescale of ther-axis).

nonsingular(vmin,vmax)[source]#

Adjust a range as needed to avoid singularities.

This method gets called during autoscaling, with(v0,v1) set tothe data limits on the Axes if the Axes contains any data, or(-inf,+inf) if not.

  • Ifv0==v1 (possibly up to some floating point slop), thismethod returns an expanded interval around this value.

  • If(v0,v1)==(-inf,+inf), this method returns appropriatedefault view limits.

  • Otherwise,(v0,v1) is returned without modification.

set_axis(axis)[source]#
view_limits(vmin,vmax)[source]#

Select a scale for the range from vmin to vmax.

Subclasses should override this method to change locator behaviour.

classThetaFormatter[source]#

Bases:Formatter

Used to format thetheta tick labels. Converts the nativeunit of radians into degrees and adds a degree symbol.

classThetaLocator(base)[source]#

Bases:Locator

Used to locate theta ticks.

This will work the same as the base locator except in the case that theview spans the entire circle. In such cases, the previously used defaultlocations of every 45 degrees are returned.

set_axis(axis)[source]#
view_limits(vmin,vmax)[source]#

Select a scale for the range from vmin to vmax.

Subclasses should override this method to change locator behaviour.

can_pan()[source]#

Return whether this Axes supports the pan/zoom button functionality.

For a polar Axes, this is slightly misleading. Both panning andzooming are performed by the same button. Panning is performedin azimuth while zooming is done along the radial.

can_zoom()[source]#

Return whether this Axes supports the zoom box button functionality.

A polar Axes does not support zoom boxes.

clear()[source]#

Clear the Axes.

drag_pan(button,key,x,y)[source]#

Called when the mouse moves during a pan operation.

Parameters:
buttonMouseButton

The pressed mouse button.

keystr or None

The pressed key, if any.

x, yfloat

The mouse coordinates in display coords.

Notes

This is intended to be overridden by new projection types.

draw(renderer)[source]#

Draw the Artist (and its children) using the given renderer.

This has no effect if the artist is not visible (Artist.get_visiblereturns False).

Parameters:
rendererRendererBase subclass.

Notes

This method is overridden in the Artist subclasses.

end_pan()[source]#

Called when a pan operation completes (when the mouse button is up.)

Notes

This is intended to be overridden by new projection types.

format_coord(theta,r)[source]#

Return a format string formatting thex,y coordinates.

get_data_ratio()[source]#

Return the aspect ratio of the data itself. For a polar plot,this should always be 1.0

get_rlabel_position()[source]#
Returns:
float

The theta position of the radius labels in degrees.

get_rmax()[source]#
Returns:
float

Outer radial limit.

get_rmin()[source]#
Returns:
float

The inner radial limit.

get_rorigin()[source]#
Returns:
float
get_rsign()[source]#
get_theta_direction()[source]#

Get the direction in which theta increases.

-1:

Theta increases in the clockwise direction

1:

Theta increases in the counterclockwise direction

get_theta_offset()[source]#

Get the offset for the location of 0 in radians.

get_thetamax()[source]#

Return the maximum theta limit in degrees.

get_thetamin()[source]#

Get the minimum theta limit in degrees.

get_xaxis_text1_transform(pad)[source]#
Returns:
transformTransform

The transform used for drawing x-axis labels, which will addpad_points of padding (in points) between the axis and the label.The x-direction is in data coordinates and the y-direction is inaxis coordinates

valign{'center', 'top', 'bottom', 'baseline', 'center_baseline'}

The text vertical alignment.

halign{'center', 'left', 'right'}

The text horizontal alignment.

Notes

This transformation is primarily used by theAxisclass, and is meant to be overridden by new kinds of projections thatmay need to place axis elements in different locations.

get_xaxis_text2_transform(pad)[source]#
Returns:
transformTransform

The transform used for drawing secondary x-axis labels, which willaddpad_points of padding (in points) between the axis and thelabel. The x-direction is in data coordinates and the y-directionis in axis coordinates

valign{'center', 'top', 'bottom', 'baseline', 'center_baseline'}

The text vertical alignment.

halign{'center', 'left', 'right'}

The text horizontal alignment.

Notes

This transformation is primarily used by theAxisclass, and is meant to be overridden by new kinds of projections thatmay need to place axis elements in different locations.

get_xaxis_transform(which='grid')[source]#

Get the transformation used for drawing x-axis labels, ticksand gridlines. The x-direction is in data coordinates and they-direction is in axis coordinates.

Note

This transformation is primarily used by theAxis class, and is meant to beoverridden by new kinds of projections that may need toplace axis elements in different locations.

Parameters:
which{'grid', 'tick1', 'tick2'}
get_yaxis_text1_transform(pad)[source]#
Returns:
transformTransform

The transform used for drawing y-axis labels, which will addpad_points of padding (in points) between the axis and the label.The x-direction is in axis coordinates and the y-direction is indata coordinates

valign{'center', 'top', 'bottom', 'baseline', 'center_baseline'}

The text vertical alignment.

halign{'center', 'left', 'right'}

The text horizontal alignment.

Notes

This transformation is primarily used by theAxisclass, and is meant to be overridden by new kinds of projections thatmay need to place axis elements in different locations.

get_yaxis_text2_transform(pad)[source]#
Returns:
transformTransform

The transform used for drawing secondart y-axis labels, which willaddpad_points of padding (in points) between the axis and thelabel. The x-direction is in axis coordinates and the y-directionis in data coordinates

valign{'center', 'top', 'bottom', 'baseline', 'center_baseline'}

The text vertical alignment.

halign{'center', 'left', 'right'}

The text horizontal alignment.

Notes

This transformation is primarily used by theAxisclass, and is meant to be overridden by new kinds of projections thatmay need to place axis elements in different locations.

get_yaxis_transform(which='grid')[source]#

Get the transformation used for drawing y-axis labels, ticksand gridlines. The x-direction is in axis coordinates and they-direction is in data coordinates.

Note

This transformation is primarily used by theAxis class, and is meant to beoverridden by new kinds of projections that may need toplace axis elements in different locations.

Parameters:
which{'grid', 'tick1', 'tick2'}
name='polar'#
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>,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>)[source]#

Set multiple properties at once.

Supported properties are

Property

Description

adjustable

{'box', 'datalim'}

agg_filter

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

alpha

float or None

anchor

(float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}

animated

bool

aspect

{'auto', 'equal'} or float

autoscale_on

bool

autoscalex_on

unknown

autoscaley_on

unknown

axes_locator

Callable[[Axes, Renderer], Bbox]

axisbelow

bool or 'line'

box_aspect

float or None

clip_box

BboxBase or None

clip_on

bool

clip_path

Patch or (Path, Transform) or None

facecolor orfc

color

figure

Figure orSubFigure

forward_navigation_events

bool or "auto"

frame_on

bool

gid

str

in_layout

bool

label

object

mouseover

bool

navigate

bool

navigate_mode

unknown

path_effects

list ofAbstractPathEffect

picker

None or bool or float or callable

position

[left, bottom, width, height] orBbox

prop_cycle

Cycler

rasterization_zorder

float or None

rasterized

bool

rgrids

tuple with floats

rlabel_position

number

rlim

unknown

rmax

float

rmin

float

rorigin

float

rscale

unknown

rticks

unknown

sketch_params

(scale: float, length: float, randomness: float)

snap

bool or None

subplotspec

unknown

theta_direction

unknown

theta_offset

unknown

theta_zero_location

str

thetagrids

tuple with floats, degrees

thetalim

unknown

thetamax

unknown

thetamin

unknown

title

str

transform

Transform

url

str

visible

bool

xbound

(lower: float, upper: float)

xlabel

str

xlim

(left: float, right: float)

xmargin

float greater than -0.5

xscale

unknown

xticklabels

unknown

xticks

unknown

ybound

(lower: float, upper: float)

ylabel

str

ylim

(bottom: float, top: float)

ymargin

float greater than -0.5

yscale

unknown

yticklabels

unknown

yticks

unknown

zorder

float

set_rgrids(radii,labels=None,angle=None,fmt=None,**kwargs)[source]#

Set the radial gridlines on a polar plot.

Parameters:
radiituple with floats

The radii for the radial gridlines

labelstuple with strings or None

The labels to use at each radial gridline. Thematplotlib.ticker.ScalarFormatter will be used if None.

anglefloat

The angular position of the radius labels in degrees.

fmtstr or None

Format string used inmatplotlib.ticker.FormatStrFormatter.For example '%f'.

Returns:
lineslist oflines.Line2D

The radial gridlines.

labelslist oftext.Text

The tick labels.

Other Parameters:
**kwargs

kwargs are optionalText properties for the labels.

Warning

This only sets the properties of the current ticks.Ticks are not guaranteed to be persistent. Various operationscan create, delete and modify the Tick instances. There is animminent risk that these settings can get lost if you work onthe figure further (including also panning/zooming on adisplayed figure).

Useset_tick_params instead if possible.

set_rlabel_position(value)[source]#

Update the theta position of the radius labels.

Parameters:
valuenumber

The angular position of the radius labels in degrees.

set_rlim(bottom=None,top=None,*,emit=True,auto=False,**kwargs)[source]#

Set the radial axis view limits.

This function behaves likeAxes.set_ylim, but additionally supportsrmin andrmax as aliases forbottom andtop.

set_rmax(rmax)[source]#

Set the outer radial limit.

Parameters:
rmaxfloat
set_rmin(rmin)[source]#

Set the inner radial limit.

Parameters:
rminfloat
set_rorigin(rorigin)[source]#

Update the radial origin.

Parameters:
roriginfloat
set_rscale(*args,**kwargs)[source]#
set_rticks(*args,**kwargs)[source]#
set_theta_direction(direction)[source]#

Set the direction in which theta increases.

clockwise, -1:

Theta increases in the clockwise direction

counterclockwise, anticlockwise, 1:

Theta increases in the counterclockwise direction

set_theta_offset(offset)[source]#

Set the offset for the location of 0 in radians.

set_theta_zero_location(loc,offset=0.0)[source]#

Set the location of theta's zero.

This simply callsset_theta_offset with the correct value in radians.

Parameters:
locstr

May be one of "N", "NW", "W", "SW", "S", "SE", "E", or "NE".

offsetfloat, default: 0

An offset in degrees to apply from the specifiedloc.Note:this offset isalways applied counter-clockwise regardless ofthe direction setting.

set_thetagrids(angles,labels=None,fmt=None,**kwargs)[source]#

Set the theta gridlines in a polar plot.

Parameters:
anglestuple with floats, degrees

The angles of the theta gridlines.

labelstuple with strings or None

The labels to use at each theta gridline. Theprojections.polar.ThetaFormatter will be used if None.

fmtstr or None

Format string used inmatplotlib.ticker.FormatStrFormatter.For example '%f'. Note that the angle that is used is inradians.

Returns:
lineslist oflines.Line2D

The theta gridlines.

labelslist oftext.Text

The tick labels.

Other Parameters:
**kwargs

kwargs are optionalText properties for the labels.

Warning

This only sets the properties of the current ticks.Ticks are not guaranteed to be persistent. Various operationscan create, delete and modify the Tick instances. There is animminent risk that these settings can get lost if you work onthe figure further (including also panning/zooming on adisplayed figure).

Useset_tick_params instead if possible.

set_thetalim(*args,**kwargs)[source]#

Set the minimum and maximum theta values.

Can take the following signatures:

  • set_thetalim(minval,maxval): Set the limits in radians.

  • set_thetalim(thetamin=minval,thetamax=maxval): Set the limitsin degrees.

where minval and maxval are the minimum and maximum limits. Values arewrapped in to the range\([0, 2\pi]\) (in radians), so for exampleit is possible to doset_thetalim(-np.pi/2,np.pi/2) to havean axis symmetric around 0. A ValueError is raised if the absoluteangle difference is larger than a full circle.

set_thetamax(thetamax)[source]#

Set the maximum theta limit in degrees.

set_thetamin(thetamin)[source]#

Set the minimum theta limit in degrees.

set_yscale(*args,**kwargs)[source]#

Set the yaxis' scale.

Parameters:
valuestr orScaleBase

The axis scale type to apply. Valid string values are the names of scaleclasses ("linear", "log", "function",...). These may be the names of anyof thebuilt-in scales or of any custom scalesregistered usingmatplotlib.scale.register_scale.

**kwargs

Ifvalue is a string, keywords are passed to the instantiation method ofthe respective class.

start_pan(x,y,button)[source]#

Called when a pan operation has started.

Parameters:
x, yfloat

The mouse coordinates in display coords.

buttonMouseButton

The pressed mouse button.

Notes

This is intended to be overridden by new projection types.

classmatplotlib.projections.polar.PolarTransform(axis=None,use_rmin=True,*,apply_theta_transforms=True,scale_transform=None)[source]#

Bases:Transform

The base polar transform.

This transform maps polar coordinates\(\theta, r\) into Cartesiancoordinates\(x, y = r \cos(\theta), r \sin(\theta)\)(but does not fully transform into Axes coordinates orhandle positioning in screen space).

This transformation is designed to be applied to data after any scalingalong the radial axis (e.g. log-scaling) has been applied to the inputdata.

Path segments at a fixed radius are automatically transformed to circulararcs as long aspath._interpolation_steps>1.

Parameters:
axisAxis, optional

Axis associated with this transform. This is used to get theminimum radial limit.

use_rminbool, optional

IfTrue, subtract the minimum radial axis limit beforetransforming to Cartesian coordinates.axis must also bespecified for this to take effect.

has_inverse=True#

True if this transform has a corresponding inverse transform.

input_dims=2#

The number of input dimensions of this transform.Must be overridden (with integers) in the subclass.

inverted()[source]#

Return the corresponding inverse transformation.

It holdsx==self.inverted().transform(self.transform(x)).

The return value of this method should be treated astemporary. An update toself does not cause a correspondingupdate to its inverted copy.

output_dims=2#

The number of output dimensions of this transform.Must be overridden (with integers) in the subclass.

transform_non_affine(values)[source]#

Apply only the non-affine part of this transformation.

transform(values) is always equivalent totransform_affine(transform_non_affine(values)).

In non-affine transformations, this is generally equivalent totransform(values). In affine transformations, this isalways a no-op.

Parameters:
valuesarray

The input values as an array of lengthinput_dims orshape (N,input_dims).

Returns:
array

The output values as an array of lengthoutput_dims orshape (N,output_dims), depending on the input.

transform_path_non_affine(path)[source]#

Apply the non-affine part of this transform toPathpath,returning a newPath.

transform_path(path) is equivalent totransform_path_affine(transform_path_non_affine(values)).

classmatplotlib.projections.polar.RadialAxis(*args,**kwargs)[source]#

Bases:YAxis

A radial Axis.

This overrides certain properties of aYAxis to provide special-casingfor a radial axis.

Parameters:
axesAxes

TheAxes to which the created Axis belongs.

pickradiusfloat

The acceptance radius for containment tests. See alsoAxis.contains.

clearbool, default: True

Whether to clear the Axis on creation. This is not required, e.g., whencreating an Axis as part of an Axes, asAxes.clear will callAxis.clear... versionadded:: 3.8

axis_name='radius'#

Read-only name identifying the axis.

clear()[source]#

Clear the axis.

This resets axis properties to their default values:

  • the label

  • the scale

  • locators, formatters and ticks

  • major and minor grid

  • units

  • registered callbacks

set(*,agg_filter=<UNSET>,alpha=<UNSET>,animated=<UNSET>,clip_box=<UNSET>,clip_on=<UNSET>,clip_path=<UNSET>,converter=<UNSET>,data_interval=<UNSET>,gid=<UNSET>,in_layout=<UNSET>,inverted=<UNSET>,label=<UNSET>,label_coords=<UNSET>,label_position=<UNSET>,label_text=<UNSET>,major_formatter=<UNSET>,major_locator=<UNSET>,minor_formatter=<UNSET>,minor_locator=<UNSET>,mouseover=<UNSET>,offset_position=<UNSET>,path_effects=<UNSET>,picker=<UNSET>,pickradius=<UNSET>,rasterized=<UNSET>,remove_overlapping_locs=<UNSET>,sketch_params=<UNSET>,snap=<UNSET>,tick_params=<UNSET>,ticklabels=<UNSET>,ticks=<UNSET>,ticks_position=<UNSET>,transform=<UNSET>,units=<UNSET>,url=<UNSET>,view_interval=<UNSET>,visible=<UNSET>,zorder=<UNSET>)[source]#

Set multiple properties at once.

Supported properties are

Property

Description

agg_filter

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

alpha

float or None

animated

bool

clip_box

BboxBase or None

clip_on

bool

clip_path

Patch or (Path, Transform) or None

converter

ConversionInterface

data_interval

unknown

figure

Figure orSubFigure

gid

str

in_layout

bool

inverted

unknown

label

unknown

label_coords

unknown

label_position

{'left', 'right'}

label_text

str

major_formatter

Formatter,str, or function

major_locator

Locator

minor_formatter

Formatter,str, or function

minor_locator

Locator

mouseover

bool

offset_position

{'left', 'right'}

path_effects

list ofAbstractPathEffect

picker

None or bool or float or callable

pickradius

float

rasterized

bool

remove_overlapping_locs

unknown

sketch_params

(scale: float, length: float, randomness: float)

snap

bool or None

tick_params

unknown

ticklabels

sequence of str or ofTexts

ticks

1D array-like

ticks_position

{'left', 'right', 'both', 'default', 'none'}

transform

Transform

units

units tag

url

str

view_interval

unknown

visible

bool

zorder

float

classmatplotlib.projections.polar.RadialLocator(base,axes=None)[source]#

Bases:Locator

Used to locate radius ticks.

Ensures that all ticks are strictly positive. For all other tasks, itdelegates to the baseLocator (which may be different depending on thescale of ther-axis).

nonsingular(vmin,vmax)[source]#

Adjust a range as needed to avoid singularities.

This method gets called during autoscaling, with(v0,v1) set tothe data limits on the Axes if the Axes contains any data, or(-inf,+inf) if not.

  • Ifv0==v1 (possibly up to some floating point slop), thismethod returns an expanded interval around this value.

  • If(v0,v1)==(-inf,+inf), this method returns appropriatedefault view limits.

  • Otherwise,(v0,v1) is returned without modification.

set_axis(axis)[source]#
view_limits(vmin,vmax)[source]#

Select a scale for the range from vmin to vmax.

Subclasses should override this method to change locator behaviour.

classmatplotlib.projections.polar.RadialTick(*args,**kwargs)[source]#

Bases:YTick

A radial-axis tick.

This subclass ofYTick provides radial ticks with some smallmodification to their re-positioning such that ticks are rotated based onaxes limits. This results in ticks that are correctly perpendicular tothe spine. Labels are also rotated to be perpendicular to the spine, when'auto' rotation is enabled.

bbox is the Bound2D bounding box in display coords of the Axesloc is the tick location in data coordssize is the tick size in points

set(*,agg_filter=<UNSET>,alpha=<UNSET>,animated=<UNSET>,clip_box=<UNSET>,clip_on=<UNSET>,clip_path=<UNSET>,gid=<UNSET>,in_layout=<UNSET>,label=<UNSET>,mouseover=<UNSET>,pad=<UNSET>,path_effects=<UNSET>,picker=<UNSET>,rasterized=<UNSET>,sketch_params=<UNSET>,snap=<UNSET>,transform=<UNSET>,url=<UNSET>,visible=<UNSET>,zorder=<UNSET>)[source]#

Set multiple properties at once.

Supported properties are

Property

Description

agg_filter

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

alpha

float or None

animated

bool

clip_box

BboxBase or None

clip_on

bool

clip_path

Patch or (Path, Transform) or None

figure

Figure orSubFigure

gid

str

in_layout

bool

label

object

mouseover

bool

pad

float

path_effects

list ofAbstractPathEffect

picker

None or bool or float or callable

rasterized

bool

sketch_params

(scale: float, length: float, randomness: float)

snap

bool or None

transform

Transform

url

str

visible

bool

zorder

float

update_position(loc)[source]#

Set the location of tick in data coords with scalarloc.

classmatplotlib.projections.polar.ThetaAxis(*args,**kwargs)[source]#

Bases:XAxis

A theta Axis.

This overrides certain properties of anXAxis to provide special-casingfor an angular axis.

Parameters:
axesAxes

TheAxes to which the created Axis belongs.

pickradiusfloat

The acceptance radius for containment tests. See alsoAxis.contains.

clearbool, default: True

Whether to clear the Axis on creation. This is not required, e.g., whencreating an Axis as part of an Axes, asAxes.clear will callAxis.clear... versionadded:: 3.8

axis_name='theta'#

Read-only name identifying the axis.

clear()[source]#

Clear the axis.

This resets axis properties to their default values:

  • the label

  • the scale

  • locators, formatters and ticks

  • major and minor grid

  • units

  • registered callbacks

set(*,agg_filter=<UNSET>,alpha=<UNSET>,animated=<UNSET>,clip_box=<UNSET>,clip_on=<UNSET>,clip_path=<UNSET>,converter=<UNSET>,data_interval=<UNSET>,gid=<UNSET>,in_layout=<UNSET>,inverted=<UNSET>,label=<UNSET>,label_coords=<UNSET>,label_position=<UNSET>,label_text=<UNSET>,major_formatter=<UNSET>,major_locator=<UNSET>,minor_formatter=<UNSET>,minor_locator=<UNSET>,mouseover=<UNSET>,path_effects=<UNSET>,picker=<UNSET>,pickradius=<UNSET>,rasterized=<UNSET>,remove_overlapping_locs=<UNSET>,sketch_params=<UNSET>,snap=<UNSET>,tick_params=<UNSET>,ticklabels=<UNSET>,ticks=<UNSET>,ticks_position=<UNSET>,transform=<UNSET>,units=<UNSET>,url=<UNSET>,view_interval=<UNSET>,visible=<UNSET>,zorder=<UNSET>)[source]#

Set multiple properties at once.

Supported properties are

Property

Description

agg_filter

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

alpha

float or None

animated

bool

clip_box

BboxBase or None

clip_on

bool

clip_path

Patch or (Path, Transform) or None

converter

ConversionInterface

data_interval

unknown

figure

Figure orSubFigure

gid

str

in_layout

bool

inverted

unknown

label

unknown

label_coords

unknown

label_position

{'top', 'bottom'}

label_text

str

major_formatter

Formatter,str, or function

major_locator

Locator

minor_formatter

Formatter,str, or function

minor_locator

Locator

mouseover

bool

path_effects

list ofAbstractPathEffect

picker

None or bool or float or callable

pickradius

float

rasterized

bool

remove_overlapping_locs

unknown

sketch_params

(scale: float, length: float, randomness: float)

snap

bool or None

tick_params

unknown

ticklabels

sequence of str or ofTexts

ticks

1D array-like

ticks_position

{'top', 'bottom', 'both', 'default', 'none'}

transform

Transform

units

units tag

url

str

view_interval

unknown

visible

bool

zorder

float

classmatplotlib.projections.polar.ThetaFormatter[source]#

Bases:Formatter

Used to format thetheta tick labels. Converts the nativeunit of radians into degrees and adds a degree symbol.

classmatplotlib.projections.polar.ThetaLocator(base)[source]#

Bases:Locator

Used to locate theta ticks.

This will work the same as the base locator except in the case that theview spans the entire circle. In such cases, the previously used defaultlocations of every 45 degrees are returned.

set_axis(axis)[source]#
view_limits(vmin,vmax)[source]#

Select a scale for the range from vmin to vmax.

Subclasses should override this method to change locator behaviour.

classmatplotlib.projections.polar.ThetaTick(axes,*args,**kwargs)[source]#

Bases:XTick

A theta-axis tick.

This subclass ofXTick provides angular ticks with some smallmodification to their re-positioning such that ticks are rotated based ontick location. This results in ticks that are correctly perpendicular tothe arc spine.

When 'auto' rotation is enabled, labels are also rotated to be parallel tothe spine. The label padding is also applied here since it's not possibleto use a generic axes transform to produce tick-specific padding.

bbox is the Bound2D bounding box in display coords of the Axesloc is the tick location in data coordssize is the tick size in points

set(*,agg_filter=<UNSET>,alpha=<UNSET>,animated=<UNSET>,clip_box=<UNSET>,clip_on=<UNSET>,clip_path=<UNSET>,gid=<UNSET>,in_layout=<UNSET>,label=<UNSET>,mouseover=<UNSET>,pad=<UNSET>,path_effects=<UNSET>,picker=<UNSET>,rasterized=<UNSET>,sketch_params=<UNSET>,snap=<UNSET>,transform=<UNSET>,url=<UNSET>,visible=<UNSET>,zorder=<UNSET>)[source]#

Set multiple properties at once.

Supported properties are

Property

Description

agg_filter

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

alpha

float or None

animated

bool

clip_box

BboxBase or None

clip_on

bool

clip_path

Patch or (Path, Transform) or None

figure

Figure orSubFigure

gid

str

in_layout

bool

label

object

mouseover

bool

pad

float

path_effects

list ofAbstractPathEffect

picker

None or bool or float or callable

rasterized

bool

sketch_params

(scale: float, length: float, randomness: float)

snap

bool or None

transform

Transform

url

str

visible

bool

zorder

float

update_position(loc)[source]#

Set the location of tick in data coords with scalarloc.

On this page