Classes for including text in a figure.
Bases: matplotlib.text.Text, matplotlib.text._AnnotationBase
An Annotation is a Text that can refer to a specific position xy. Optionally an arrow pointing from the text to xy can be drawn.
The annotated position.
The coordinate system for xy.
A FancyArrowPatch to point from xytext to xy.
Annotate the point xy with text text.
In the simplest form, the text is placed at xy.
Optionally, the text can be displayed in another position xytext. An arrow pointing from the text to the annotated point xy can then be added by defining arrowprops.
The text of the annotation.
The point (x, y) to annotate. The coordinate system is determined by xycoords.
The position (x, y) to place the text at. The coordinate system is determined by textcoords.
The coordinate system that xy is given in. The following types of values are supported:
One of the following strings:
Value
Description
'figure points'
Points from the lower left of the figure
'figure pixels'
Pixels from the lower left of the figure
'figure fraction'
Fraction of figure from lower left
'subfigure points'
Points from the lower left of the subfigure
'subfigure pixels'
Pixels from the lower left of the subfigure
'subfigure fraction'
Fraction of subfigure from lower left
'axes points'
Points from lower left corner of axes
'axes pixels'
Pixels from lower left corner of axes
'axes fraction'
Fraction of axes from lower left
'data'
Use the coordinate system of the object being annotated (default)
'polar'
(theta, r) if not native 'data' coordinates
Note that 'subfigure pixels' and 'figure pixels' are the same for the parent figure, so users who want code that is usable in a subfigure can use 'subfigure pixels'.
A function with one of the following signatures:
where renderer is a RendererBase subclass.
The result of the function is interpreted like the Artist and Transform cases above.
See Advanced Annotations for more details.
The coordinate system that xytext is given in.
All xycoords values are valid as well as the following strings:
Value
Description
'offset points'
Offset (in points) from the xy value
'offset pixels'
Offset (in pixels) from the xy value
The properties used to draw a FancyArrowPatch arrow between the positions xy and xytext. Defaults to None, i.e. no arrow is drawn.
For historical reasons there are two different ways to specify arrows, "simple" and "fancy":
Simple arrow:
If arrowprops does not contain the key 'arrowstyle' the allowed keys are:
Key
Description
width
The width of the arrow in points
headwidth
The width of the base of the arrow head in points
headlength
The length of the arrow head in points
shrink
Fraction of total length to shrink from both ends
?
Any key to matplotlib.patches.FancyArrowPatch
The arrow is attached to the edge of the text box, the exact position (corners or centers) depending on where it's pointing to.
Fancy arrow:
This is used if 'arrowstyle' is provided in the arrowprops.
Valid keys are the following FancyArrowPatch parameters:
Key
Description
arrowstyle
the arrow style
connectionstyle
the connection style
relpos
see below; default is (0.5, 0.5)
patchA
default is bounding box of the text
patchB
default is None
shrinkA
default is 2 points
shrinkB
default is 2 points
mutation_scale
default is text size (in points)
mutation_aspect
default is 1.
?
any key for matplotlib.patches.PathPatch
The exact starting point position of the arrow is defined by relpos. It's a tuple of relative coordinates of the text box, where (0, 0) is the lower left corner and (1, 1) is the upper right corner. Values <0 and >1 are supported and specify points outside the text box. By default (0.5, 0.5) the starting point is centered in the text box.
Whether to draw the annotation when the annotation point xy is outside the axes area.
Additional kwargs are passed to Text.
See also
The coordinate system to use for Annotation.xyann.
Return whether the mouse event occurred inside the axis-aligned bounding-box of the text.
Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.
Return the coordinate system to use for Annotation.xyann.
See also xycoords in Annotation.
Like Artist.get_window_extent, but includes any clipping.
renderer that will be used to draw the figures (i.e. fig.canvas.get_renderer())
The enclosing bounding box (in figure pixel coordinates).
Return the Bbox bounding the text, in display units.
In addition to being used internally, this is useful for specifying clickable regions in a png file on a web page.
A renderer is needed to compute the bounding box. If the artist has already been drawn, the renderer is cached; thus, it is only necessary to pass this argument when calling get_window_extent before the first draw. In practice, it is usually easier to trigger a draw first (e.g. by saving the figure).
The dpi value for computing the bbox, defaults to self.figure.dpi (not the renderer dpi); should be set e.g. if to match regions with a figure saved with a custom dpi value.
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
alpha
scalar or None
animated
bool
anncoords
unknown
annotation_clip
bool or None
backgroundcolor
color
bbox
dict with properties for patches.FancyBboxPatch
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color or c
color
figure
unknown
fontfamily or family
{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties or font or font_properties
font_manager.FontProperties or str or pathlib.Path
fontsize or size
float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch or stretch
{a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}
fontstyle or style
{'normal', 'italic', 'oblique'}
fontvariant or variant
{'normal', 'small-caps'}
fontweight or weight
{a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
gid
str
horizontalalignment or ha
{'center', 'right', 'left'}
in_layout
bool
label
object
linespacing
float (multiple of font size)
math_fontfamily
str
multialignment or ma
{'left', 'right', 'center'}
parse_math
bool
path_effects
AbstractPathEffect
picker
None or bool or float or callable
position
(float, float)
rasterized
bool
rotation
float or {'vertical', 'horizontal'}
rotation_mode
{None, 'default', 'anchor'}
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
text
object
transform
Transform
transform_rotates_text
bool
url
str
usetex
bool or None
verticalalignment or va
{'center', 'top', 'bottom', 'baseline', 'center_baseline'}
visible
bool
wrap
bool
x
float
y
float
zorder
float
Set the coordinate system to use for Annotation.xyann.
See also xycoords in Annotation.
Set the Figure instance the artist belongs to.
Update the pixel positions of the annotation text and the arrow patch.
The text position.
See also xytext in Annotation.
Bases: object
Callable helper class for working with Annotation.
The object to compute the offset from.
If artist is an Artist or BboxBase, this values is the location to of the offset origin in fractions of the artist bounding box.
If artist is a transform, the offset origin is the transform applied to this value.
The screen units to use (pixels or points) for the offset input.
Return the unit for input to the transform used by __call__.
Set the unit for input to the transform used by __call__.
Bases: matplotlib.artist.Artist
Handle storing and drawing of text in window or data coordinates.
Create a Text instance at x, y with string text.
Valid keyword arguments 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
alpha
scalar or None
animated
bool
backgroundcolor
color
bbox
dict with properties for patches.FancyBboxPatch
clip_box
unknown
clip_on
unknown
clip_path
unknown
color or c
color
figure
Figure
fontfamily or family
{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties or font or font_properties
font_manager.FontProperties or str or pathlib.Path
fontsize or size
float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch or stretch
{a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}
fontstyle or style
{'normal', 'italic', 'oblique'}
fontvariant or variant
{'normal', 'small-caps'}
fontweight or weight
{a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
gid
str
horizontalalignment or ha
{'center', 'right', 'left'}
in_layout
bool
label
object
linespacing
float (multiple of font size)
math_fontfamily
str
multialignment or ma
{'left', 'right', 'center'}
parse_math
bool
path_effects
AbstractPathEffect
picker
None or bool or float or callable
position
(float, float)
rasterized
bool
rotation
float or {'vertical', 'horizontal'}
rotation_mode
{None, 'default', 'anchor'}
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
text
object
transform
Transform
transform_rotates_text
bool
url
str
usetex
bool or None
verticalalignment or va
{'center', 'top', 'bottom', 'baseline', 'center_baseline'}
visible
bool
wrap
bool
x
float
y
float
zorder
float
Return whether the mouse event occurred inside the axis-aligned bounding-box of the text.
Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.
Return the bbox Patch, or None if the patches.FancyBboxPatch is not made.
Alias for get_color.
Return the color of the text.
Alias for get_fontfamily.
Alias for get_fontproperties.
Alias for get_fontproperties.
Return the list of font families used for font lookup.
See also
Return the font name as a string.
See also
Return the font_manager.FontProperties.
Return the font size as an integer.
See also
Return the font style as a string.
See also
Return the font variant as a string.
See also
Return the font weight as a string or a number.
See also
Alias for get_horizontalalignment.
Return the horizontal alignment as a string. Will be one of 'left', 'center' or 'right'.
Return the font family name for math text rendered by Matplotlib.
The default value is rcParams["mathtext.fontset"] (default: 'dejavusans').
See also
Alias for get_fontname.
Return whether mathtext parsing is considered for this Text.
Return the (x, y) position of the text.
[Deprecated] Return a hashable tuple of properties.
Not intended to be human readable, but useful for backends who want to cache derived information about text (e.g., layouts) and need to know if the text has changed.
Deprecated since version 3.5.
Return the text angle in degrees between 0 and 360.
Return the text rotation mode.
Alias for get_fontsize.
Return the font stretch as a string or a number.
See also
Alias for get_fontstyle.
Return the text string.
Return whether rotations of the transform affect the text direction.
Return the (x, y) unitless position of the text.
Return whether this Text object uses TeX for rendering.
Alias for get_verticalalignment.
Alias for get_fontvariant.
Return the vertical alignment as a string. Will be one of 'top', 'center', 'bottom', 'baseline' or 'center_baseline'.
Alias for get_fontweight.
Return the Bbox bounding the text, in display units.
In addition to being used internally, this is useful for specifying clickable regions in a png file on a web page.
A renderer is needed to compute the bounding box. If the artist has already been drawn, the renderer is cached; thus, it is only necessary to pass this argument when calling get_window_extent before the first draw. In practice, it is usually easier to trigger a draw first (e.g. by saving the figure).
The dpi value for computing the bbox, defaults to self.figure.dpi (not the renderer dpi); should be set e.g. if to match regions with a figure saved with a custom dpi value.
Return whether the text can be wrapped.
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
alpha
scalar or None
animated
bool
backgroundcolor
color
bbox
dict with properties for patches.FancyBboxPatch
clip_box
unknown
clip_on
unknown
clip_path
unknown
color
color
figure
Figure
fontfamily
{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties
font_manager.FontProperties or str or pathlib.Path
fontsize
float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch
{a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}
fontstyle
{'normal', 'italic', 'oblique'}
fontvariant
{'normal', 'small-caps'}
fontweight
{a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
gid
str
horizontalalignment
{'center', 'right', 'left'}
in_layout
bool
label
object
linespacing
float (multiple of font size)
math_fontfamily
str
multialignment
{'left', 'right', 'center'}
parse_math
bool
path_effects
AbstractPathEffect
picker
None or bool or float or callable
position
(float, float)
rasterized
bool
rotation
float or {'vertical', 'horizontal'}
rotation_mode
{None, 'default', 'anchor'}
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
text
object
transform
Transform
transform_rotates_text
bool
url
str
usetex
bool or None
verticalalignment
{'center', 'top', 'bottom', 'baseline', 'center_baseline'}
visible
bool
wrap
bool
x
float
y
float
zorder
float
Set the background color of the text by updating the bbox.
See also
To change the position of the bounding box
Draw a bounding box around self.
The default boxstyle is 'square'. The mutation scale of the patches.FancyBboxPatch is set to the fontsize.
Alias for set_color.
Set the artist's clip Bbox.
Set whether the artist uses clipping.
When False artists will be visible outside of the axes which can lead to unexpected results.
Set the artist's clip path.
The clip path. If given a Path, transform must be provided as well. If None, a previously set clip path is removed.
Only used if path is a Path, in which case the given Path is converted to a TransformedPath using transform.
For efficiency, if path is a Rectangle this method will set the clipping box to the corresponding rectangle and set the clipping path to None.
For technical reasons (support of set), a tuple (path, transform) is also accepted as a single positional parameter.
Set the foreground color of the text
Alias for set_fontfamily.
Alias for set_fontproperties.
Alias for set_fontproperties.
Set the font family. May be either a single string, or a list of strings in decreasing priority. Each string may be either a real font name or a generic font class name. If the latter, the specific font names will be looked up in the corresponding rcParams.
If a Text instance is constructed with fontfamily=None, then the font is set to rcParams["font.family"] (default: ['sans-serif']), and the same is done when set_fontfamily() is called on an existing Text instance.
See also
Alias for set_family.
One-way alias only: the getter differs.
See also
Set the font properties that control the text.
If a str, it is interpreted as a fontconfig pattern parsed by FontProperties. If a pathlib.Path, it is interpreted as the absolute path to a font file.
Set the font size.
If float, the fontsize in points. The string values denote sizes relative to the default font size.
See also
Set the font stretch (horizontal condensation or expansion).
See also
Set the font style.
See also
Set the font variant.
See also
Set the font weight.
See also
Alias for set_horizontalalignment.
Set the horizontal alignment to one of
Set the line spacing as a multiple of the font size.
The default line spacing is 1.2.
Alias for set_multialignment.
Set the font family for math text rendered by Matplotlib.
This does only affect Matplotlib's own math renderer. It has no effect when rendering with TeX (usetex=True).
The name of the font family.
Available font families are defined in the matplotlibrc.template file.
See also
Set the text alignment for multiline texts.
The layout of the bounding box of all the lines is determined by the horizontalalignment and verticalalignment properties. This property controls the alignment of the text lines within that box.
Alias for set_fontname.
Override switch to disable any mathtext parsing for this Text.
If False, this Text will never use mathtext. If True, mathtext will be used if there is an even number of unescaped dollar signs.
Set the (x, y) position of the text.
Set the rotation of the text.
The rotation angle in degrees in mathematically positive direction (counterclockwise). 'horizontal' equals 0, 'vertical' equals 90.
Set text rotation mode.
If None or "default", the text will be first rotated, then aligned according to their horizontal and vertical alignments. If "anchor", then alignment occurs before rotation.
Alias for set_fontsize.
Alias for set_fontstretch.
Alias for set_fontstyle.
Set the text string s.
It may contain newlines (\n) or math in LaTeX syntax.
Any object gets converted to its str representation, except for None which is converted to an empty string.
Whether rotations of the transform affect the text direction.
Whether to render using TeX, None means to use rcParams["text.usetex"] (default: False).
Alias for set_verticalalignment.
Alias for set_fontvariant.
Set the vertical alignment.
Alias for set_fontweight.
Set whether the text can be wrapped.
Wrapping does not work together with savefig(..., bbox_inches='tight') (which is also used internally by %matplotlib inline in IPython/Jupyter). The 'tight' setting rescales the canvas to accommodate all content and happens before wrapping.
Set the x position of the text.
Set the y position of the text.
Update this artist's properties from the dict props.
Update the location and the size of the bbox.
This method should be used when the position and size of the bbox needs to be updated before actually drawing the bbox.
Copy properties from other to self.
Return rotation normalized to an angle between 0 and 360 degrees.
Rotation angle in degrees. None and 'horizontal' equal 0, 'vertical' equals 90.


Bases: matplotlib.text.Text, matplotlib.text._AnnotationBase
An Annotation is a Text that can refer to a specific position xy. Optionally an arrow pointing from the text to xy can be drawn.
The annotated position.
The coordinate system for xy.
A FancyArrowPatch to point from xytext to xy.
Annotate the point xy with text text.
In the simplest form, the text is placed at xy.
Optionally, the text can be displayed in another position xytext. An arrow pointing from the text to the annotated point xy can then be added by defining arrowprops.
The text of the annotation.
The point (x, y) to annotate. The coordinate system is determined by xycoords.
The position (x, y) to place the text at. The coordinate system is determined by textcoords.
The coordinate system that xy is given in. The following types of values are supported:
One of the following strings:
Value
Description
'figure points'
Points from the lower left of the figure
'figure pixels'
Pixels from the lower left of the figure
'figure fraction'
Fraction of figure from lower left
'subfigure points'
Points from the lower left of the subfigure
'subfigure pixels'
Pixels from the lower left of the subfigure
'subfigure fraction'
Fraction of subfigure from lower left
'axes points'
Points from lower left corner of axes
'axes pixels'
Pixels from lower left corner of axes
'axes fraction'
Fraction of axes from lower left
'data'
Use the coordinate system of the object being annotated (default)
'polar'
(theta, r) if not native 'data' coordinates
Note that 'subfigure pixels' and 'figure pixels' are the same for the parent figure, so users who want code that is usable in a subfigure can use 'subfigure pixels'.
A function with one of the following signatures:
where renderer is a RendererBase subclass.
The result of the function is interpreted like the Artist and Transform cases above.
See Advanced Annotations for more details.
The coordinate system that xytext is given in.
All xycoords values are valid as well as the following strings:
Value
Description
'offset points'
Offset (in points) from the xy value
'offset pixels'
Offset (in pixels) from the xy value
The properties used to draw a FancyArrowPatch arrow between the positions xy and xytext. Defaults to None, i.e. no arrow is drawn.
For historical reasons there are two different ways to specify arrows, "simple" and "fancy":
Simple arrow:
If arrowprops does not contain the key 'arrowstyle' the allowed keys are:
Key
Description
width
The width of the arrow in points
headwidth
The width of the base of the arrow head in points
headlength
The length of the arrow head in points
shrink
Fraction of total length to shrink from both ends
?
Any key to matplotlib.patches.FancyArrowPatch
The arrow is attached to the edge of the text box, the exact position (corners or centers) depending on where it's pointing to.
Fancy arrow:
This is used if 'arrowstyle' is provided in the arrowprops.
Valid keys are the following FancyArrowPatch parameters:
Key
Description
arrowstyle
the arrow style
connectionstyle
the connection style
relpos
see below; default is (0.5, 0.5)
patchA
default is bounding box of the text
patchB
default is None
shrinkA
default is 2 points
shrinkB
default is 2 points
mutation_scale
default is text size (in points)
mutation_aspect
default is 1.
?
any key for matplotlib.patches.PathPatch
The exact starting point position of the arrow is defined by relpos. It's a tuple of relative coordinates of the text box, where (0, 0) is the lower left corner and (1, 1) is the upper right corner. Values <0 and >1 are supported and specify points outside the text box. By default (0.5, 0.5) the starting point is centered in the text box.
Whether to draw the annotation when the annotation point xy is outside the axes area.
Additional kwargs are passed to Text.
See also
The coordinate system to use for Annotation.xyann.
Return whether the mouse event occurred inside the axis-aligned bounding-box of the text.
Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.
Return the coordinate system to use for Annotation.xyann.
See also xycoords in Annotation.
Like Artist.get_window_extent, but includes any clipping.
renderer that will be used to draw the figures (i.e. fig.canvas.get_renderer())
The enclosing bounding box (in figure pixel coordinates).
Return the Bbox bounding the text, in display units.
In addition to being used internally, this is useful for specifying clickable regions in a png file on a web page.
A renderer is needed to compute the bounding box. If the artist has already been drawn, the renderer is cached; thus, it is only necessary to pass this argument when calling get_window_extent before the first draw. In practice, it is usually easier to trigger a draw first (e.g. by saving the figure).
The dpi value for computing the bbox, defaults to self.figure.dpi (not the renderer dpi); should be set e.g. if to match regions with a figure saved with a custom dpi value.
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
alpha
scalar or None
animated
bool
anncoords
unknown
annotation_clip
bool or None
backgroundcolor
color
bbox
dict with properties for patches.FancyBboxPatch
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color or c
color
figure
unknown
fontfamily or family
{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties or font or font_properties
font_manager.FontProperties or str or pathlib.Path
fontsize or size
float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch or stretch
{a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}
fontstyle or style
{'normal', 'italic', 'oblique'}
fontvariant or variant
{'normal', 'small-caps'}
fontweight or weight
{a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
gid
str
horizontalalignment or ha
{'center', 'right', 'left'}
in_layout
bool
label
object
linespacing
float (multiple of font size)
math_fontfamily
str
multialignment or ma
{'left', 'right', 'center'}
parse_math
bool
path_effects
AbstractPathEffect
picker
None or bool or float or callable
position
(float, float)
rasterized
bool
rotation
float or {'vertical', 'horizontal'}
rotation_mode
{None, 'default', 'anchor'}
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
text
object
transform
Transform
transform_rotates_text
bool
url
str
usetex
bool or None
verticalalignment or va
{'center', 'top', 'bottom', 'baseline', 'center_baseline'}
visible
bool
wrap
bool
x
float
y
float
zorder
float
Set the coordinate system to use for Annotation.xyann.
See also xycoords in Annotation.
Set the Figure instance the artist belongs to.
Update the pixel positions of the annotation text and the arrow patch.
The text position.
See also xytext in Annotation.


Return whether the mouse event occurred inside the axis-aligned bounding-box of the text.


Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.


Return the coordinate system to use for Annotation.xyann.
See also xycoords in Annotation.


Like Artist.get_window_extent, but includes any clipping.
renderer that will be used to draw the figures (i.e. fig.canvas.get_renderer())
The enclosing bounding box (in figure pixel coordinates).


Return the Bbox bounding the text, in display units.
In addition to being used internally, this is useful for specifying clickable regions in a png file on a web page.
A renderer is needed to compute the bounding box. If the artist has already been drawn, the renderer is cached; thus, it is only necessary to pass this argument when calling get_window_extent before the first draw. In practice, it is usually easier to trigger a draw first (e.g. by saving the figure).
The dpi value for computing the bbox, defaults to self.figure.dpi (not the renderer dpi); should be set e.g. if to match regions with a figure saved with a custom dpi value.


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
alpha
scalar or None
animated
bool
anncoords
unknown
annotation_clip
bool or None
backgroundcolor
color
bbox
dict with properties for patches.FancyBboxPatch
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color or c
color
figure
unknown
fontfamily or family
{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties or font or font_properties
font_manager.FontProperties or str or pathlib.Path
fontsize or size
float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch or stretch
{a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}
fontstyle or style
{'normal', 'italic', 'oblique'}
fontvariant or variant
{'normal', 'small-caps'}
fontweight or weight
{a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
gid
str
horizontalalignment or ha
{'center', 'right', 'left'}
in_layout
bool
label
object
linespacing
float (multiple of font size)
math_fontfamily
str
multialignment or ma
{'left', 'right', 'center'}
parse_math
bool
path_effects
AbstractPathEffect
picker
None or bool or float or callable
position
(float, float)
rasterized
bool
rotation
float or {'vertical', 'horizontal'}
rotation_mode
{None, 'default', 'anchor'}
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
text
object
transform
Transform
transform_rotates_text
bool
url
str
usetex
bool or None
verticalalignment or va
{'center', 'top', 'bottom', 'baseline', 'center_baseline'}
visible
bool
wrap
bool
x
float
y
float
zorder
float


Set the coordinate system to use for Annotation.xyann.
See also xycoords in Annotation.


Set the Figure instance the artist belongs to.


Update the pixel positions of the annotation text and the arrow patch.


Return rotation normalized to an angle between 0 and 360 degrees.
Rotation angle in degrees. None and 'horizontal' equal 0, 'vertical' equals 90.


Bases: object
Callable helper class for working with Annotation.
The object to compute the offset from.
If artist is an Artist or BboxBase, this values is the location to of the offset origin in fractions of the artist bounding box.
If artist is a transform, the offset origin is the transform applied to this value.
The screen units to use (pixels or points) for the offset input.
Return the unit for input to the transform used by __call__.
Set the unit for input to the transform used by __call__.


Return the unit for input to the transform used by __call__.


Set the unit for input to the transform used by __call__.


Bases: matplotlib.artist.Artist
Handle storing and drawing of text in window or data coordinates.
Create a Text instance at x, y with string text.
Valid keyword arguments 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
alpha
scalar or None
animated
bool
backgroundcolor
color
bbox
dict with properties for patches.FancyBboxPatch
clip_box
unknown
clip_on
unknown
clip_path
unknown
color or c
color
figure
Figure
fontfamily or family
{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties or font or font_properties
font_manager.FontProperties or str or pathlib.Path
fontsize or size
float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch or stretch
{a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}
fontstyle or style
{'normal', 'italic', 'oblique'}
fontvariant or variant
{'normal', 'small-caps'}
fontweight or weight
{a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
gid
str
horizontalalignment or ha
{'center', 'right', 'left'}
in_layout
bool
label
object
linespacing
float (multiple of font size)
math_fontfamily
str
multialignment or ma
{'left', 'right', 'center'}
parse_math
bool
path_effects
AbstractPathEffect
picker
None or bool or float or callable
position
(float, float)
rasterized
bool
rotation
float or {'vertical', 'horizontal'}
rotation_mode
{None, 'default', 'anchor'}
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
text
object
transform
Transform
transform_rotates_text
bool
url
str
usetex
bool or None
verticalalignment or va
{'center', 'top', 'bottom', 'baseline', 'center_baseline'}
visible
bool
wrap
bool
x
float
y
float
zorder
float
Return whether the mouse event occurred inside the axis-aligned bounding-box of the text.
Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.
Return the bbox Patch, or None if the patches.FancyBboxPatch is not made.
Alias for get_color.
Return the color of the text.
Alias for get_fontfamily.
Alias for get_fontproperties.
Alias for get_fontproperties.
Return the list of font families used for font lookup.
See also
Return the font name as a string.
See also
Return the font_manager.FontProperties.
Return the font size as an integer.
See also
Return the font style as a string.
See also
Return the font variant as a string.
See also
Return the font weight as a string or a number.
See also
Alias for get_horizontalalignment.
Return the horizontal alignment as a string. Will be one of 'left', 'center' or 'right'.
Return the font family name for math text rendered by Matplotlib.
The default value is rcParams["mathtext.fontset"] (default: 'dejavusans').
See also
Alias for get_fontname.
Return whether mathtext parsing is considered for this Text.
Return the (x, y) position of the text.
[Deprecated] Return a hashable tuple of properties.
Not intended to be human readable, but useful for backends who want to cache derived information about text (e.g., layouts) and need to know if the text has changed.
Deprecated since version 3.5.
Return the text angle in degrees between 0 and 360.
Return the text rotation mode.
Alias for get_fontsize.
Return the font stretch as a string or a number.
See also
Alias for get_fontstyle.
Return the text string.
Return whether rotations of the transform affect the text direction.
Return the (x, y) unitless position of the text.
Return whether this Text object uses TeX for rendering.
Alias for get_verticalalignment.
Alias for get_fontvariant.
Return the vertical alignment as a string. Will be one of 'top', 'center', 'bottom', 'baseline' or 'center_baseline'.
Alias for get_fontweight.
Return the Bbox bounding the text, in display units.
In addition to being used internally, this is useful for specifying clickable regions in a png file on a web page.
A renderer is needed to compute the bounding box. If the artist has already been drawn, the renderer is cached; thus, it is only necessary to pass this argument when calling get_window_extent before the first draw. In practice, it is usually easier to trigger a draw first (e.g. by saving the figure).
The dpi value for computing the bbox, defaults to self.figure.dpi (not the renderer dpi); should be set e.g. if to match regions with a figure saved with a custom dpi value.
Return whether the text can be wrapped.
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
alpha
scalar or None
animated
bool
backgroundcolor
color
bbox
dict with properties for patches.FancyBboxPatch
clip_box
unknown
clip_on
unknown
clip_path
unknown
color
color
figure
Figure
fontfamily
{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties
font_manager.FontProperties or str or pathlib.Path
fontsize
float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch
{a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}
fontstyle
{'normal', 'italic', 'oblique'}
fontvariant
{'normal', 'small-caps'}
fontweight
{a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
gid
str
horizontalalignment
{'center', 'right', 'left'}
in_layout
bool
label
object
linespacing
float (multiple of font size)
math_fontfamily
str
multialignment
{'left', 'right', 'center'}
parse_math
bool
path_effects
AbstractPathEffect
picker
None or bool or float or callable
position
(float, float)
rasterized
bool
rotation
float or {'vertical', 'horizontal'}
rotation_mode
{None, 'default', 'anchor'}
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
text
object
transform
Transform
transform_rotates_text
bool
url
str
usetex
bool or None
verticalalignment
{'center', 'top', 'bottom', 'baseline', 'center_baseline'}
visible
bool
wrap
bool
x
float
y
float
zorder
float
Set the background color of the text by updating the bbox.
See also
To change the position of the bounding box
Draw a bounding box around self.
The default boxstyle is 'square'. The mutation scale of the patches.FancyBboxPatch is set to the fontsize.
Alias for set_color.
Set the artist's clip Bbox.
Set whether the artist uses clipping.
When False artists will be visible outside of the axes which can lead to unexpected results.
Set the artist's clip path.
The clip path. If given a Path, transform must be provided as well. If None, a previously set clip path is removed.
Only used if path is a Path, in which case the given Path is converted to a TransformedPath using transform.
For efficiency, if path is a Rectangle this method will set the clipping box to the corresponding rectangle and set the clipping path to None.
For technical reasons (support of set), a tuple (path, transform) is also accepted as a single positional parameter.
Set the foreground color of the text
Alias for set_fontfamily.
Alias for set_fontproperties.
Alias for set_fontproperties.
Set the font family. May be either a single string, or a list of strings in decreasing priority. Each string may be either a real font name or a generic font class name. If the latter, the specific font names will be looked up in the corresponding rcParams.
If a Text instance is constructed with fontfamily=None, then the font is set to rcParams["font.family"] (default: ['sans-serif']), and the same is done when set_fontfamily() is called on an existing Text instance.
See also
Alias for set_family.
One-way alias only: the getter differs.
See also
Set the font properties that control the text.
If a str, it is interpreted as a fontconfig pattern parsed by FontProperties. If a pathlib.Path, it is interpreted as the absolute path to a font file.
Set the font size.
If float, the fontsize in points. The string values denote sizes relative to the default font size.
See also
Set the font stretch (horizontal condensation or expansion).
See also
Set the font style.
See also
Set the font variant.
See also
Set the font weight.
See also
Alias for set_horizontalalignment.
Set the horizontal alignment to one of
Set the line spacing as a multiple of the font size.
The default line spacing is 1.2.
Alias for set_multialignment.
Set the font family for math text rendered by Matplotlib.
This does only affect Matplotlib's own math renderer. It has no effect when rendering with TeX (usetex=True).
The name of the font family.
Available font families are defined in the matplotlibrc.template file.
See also
Set the text alignment for multiline texts.
The layout of the bounding box of all the lines is determined by the horizontalalignment and verticalalignment properties. This property controls the alignment of the text lines within that box.
Alias for set_fontname.
Override switch to disable any mathtext parsing for this Text.
If False, this Text will never use mathtext. If True, mathtext will be used if there is an even number of unescaped dollar signs.
Set the (x, y) position of the text.
Set the rotation of the text.
The rotation angle in degrees in mathematically positive direction (counterclockwise). 'horizontal' equals 0, 'vertical' equals 90.
Set text rotation mode.
If None or "default", the text will be first rotated, then aligned according to their horizontal and vertical alignments. If "anchor", then alignment occurs before rotation.
Alias for set_fontsize.
Alias for set_fontstretch.
Alias for set_fontstyle.
Set the text string s.
It may contain newlines (\n) or math in LaTeX syntax.
Any object gets converted to its str representation, except for None which is converted to an empty string.
Whether rotations of the transform affect the text direction.
Whether to render using TeX, None means to use rcParams["text.usetex"] (default: False).
Alias for set_verticalalignment.
Alias for set_fontvariant.
Set the vertical alignment.
Alias for set_fontweight.
Set whether the text can be wrapped.
Wrapping does not work together with savefig(..., bbox_inches='tight') (which is also used internally by %matplotlib inline in IPython/Jupyter). The 'tight' setting rescales the canvas to accommodate all content and happens before wrapping.
Set the x position of the text.
Set the y position of the text.
Update this artist's properties from the dict props.
Update the location and the size of the bbox.
This method should be used when the position and size of the bbox needs to be updated before actually drawing the bbox.
Copy properties from other to self.


Return the bbox Patch, or None if the patches.FancyBboxPatch is not made.


Return the list of font families used for font lookup.
See also


Return the font name as a string.
See also


Return the font size as an integer.
See also


Return the font style as a string.
See also


Return the font variant as a string.
See also


Return the font weight as a string or a number.
See also


Return the horizontal alignment as a string. Will be one of 'left', 'center' or 'right'.


Return the font family name for math text rendered by Matplotlib.
The default value is rcParams["mathtext.fontset"] (default: 'dejavusans').
See also


Return whether mathtext parsing is considered for this Text.


[Deprecated] Return a hashable tuple of properties.
Not intended to be human readable, but useful for backends who want to cache derived information about text (e.g., layouts) and need to know if the text has changed.
Deprecated since version 3.5.


Return the text angle in degrees between 0 and 360.


Return the font stretch as a string or a number.
See also


Return whether rotations of the transform affect the text direction.


Return the (x, y) unitless position of the text.


Return whether this Text object uses TeX for rendering.


Return the vertical alignment as a string. Will be one of 'top', 'center', 'bottom', 'baseline' or 'center_baseline'.


Return the Bbox bounding the text, in display units.
In addition to being used internally, this is useful for specifying clickable regions in a png file on a web page.
A renderer is needed to compute the bounding box. If the artist has already been drawn, the renderer is cached; thus, it is only necessary to pass this argument when calling get_window_extent before the first draw. In practice, it is usually easier to trigger a draw first (e.g. by saving the figure).
The dpi value for computing the bbox, defaults to self.figure.dpi (not the renderer dpi); should be set e.g. if to match regions with a figure saved with a custom dpi value.


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
alpha
scalar or None
animated
bool
backgroundcolor
color
bbox
dict with properties for patches.FancyBboxPatch
clip_box
unknown
clip_on
unknown
clip_path
unknown
color
color
figure
Figure
fontfamily
{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties
font_manager.FontProperties or str or pathlib.Path
fontsize
float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch
{a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}
fontstyle
{'normal', 'italic', 'oblique'}
fontvariant
{'normal', 'small-caps'}
fontweight
{a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
gid
str
horizontalalignment
{'center', 'right', 'left'}
in_layout
bool
label
object
linespacing
float (multiple of font size)
math_fontfamily
str
multialignment
{'left', 'right', 'center'}
parse_math
bool
path_effects
AbstractPathEffect
picker
None or bool or float or callable
position
(float, float)
rasterized
bool
rotation
float or {'vertical', 'horizontal'}
rotation_mode
{None, 'default', 'anchor'}
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
text
object
transform
Transform
transform_rotates_text
bool
url
str
usetex
bool or None
verticalalignment
{'center', 'top', 'bottom', 'baseline', 'center_baseline'}
visible
bool
wrap
bool
x
float
y
float
zorder
float


Set the background color of the text by updating the bbox.
See also
To change the position of the bounding box


Draw a bounding box around self.
The default boxstyle is 'square'. The mutation scale of the patches.FancyBboxPatch is set to the fontsize.


Set whether the artist uses clipping.
When False artists will be visible outside of the axes which can lead to unexpected results.


Set the artist's clip path.
The clip path. If given a Path, transform must be provided as well. If None, a previously set clip path is removed.
Only used if path is a Path, in which case the given Path is converted to a TransformedPath using transform.
For efficiency, if path is a Rectangle this method will set the clipping box to the corresponding rectangle and set the clipping path to None.
For technical reasons (support of set), a tuple (path, transform) is also accepted as a single positional parameter.


Set the font family. May be either a single string, or a list of strings in decreasing priority. Each string may be either a real font name or a generic font class name. If the latter, the specific font names will be looked up in the corresponding rcParams.
If a Text instance is constructed with fontfamily=None, then the font is set to rcParams["font.family"] (default: ['sans-serif']), and the same is done when set_fontfamily() is called on an existing Text instance.
See also


Alias for set_family.
One-way alias only: the getter differs.
See also


Set the font properties that control the text.
If a str, it is interpreted as a fontconfig pattern parsed by FontProperties. If a pathlib.Path, it is interpreted as the absolute path to a font file.


Set the font size.
If float, the fontsize in points. The string values denote sizes relative to the default font size.
See also


Set the font stretch (horizontal condensation or expansion).
See also


Set the line spacing as a multiple of the font size.
The default line spacing is 1.2.


Set the font family for math text rendered by Matplotlib.
This does only affect Matplotlib's own math renderer. It has no effect when rendering with TeX (usetex=True).
The name of the font family.
Available font families are defined in the matplotlibrc.template file.
See also


Set the text alignment for multiline texts.
The layout of the bounding box of all the lines is determined by the horizontalalignment and verticalalignment properties. This property controls the alignment of the text lines within that box.


Override switch to disable any mathtext parsing for this Text.
If False, this Text will never use mathtext. If True, mathtext will be used if there is an even number of unescaped dollar signs.


Set the rotation of the text.
The rotation angle in degrees in mathematically positive direction (counterclockwise). 'horizontal' equals 0, 'vertical' equals 90.


Set text rotation mode.
If None or "default", the text will be first rotated, then aligned according to their horizontal and vertical alignments. If "anchor", then alignment occurs before rotation.


Set the text string s.
It may contain newlines (\n) or math in LaTeX syntax.
Any object gets converted to its str representation, except for None which is converted to an empty string.


Whether rotations of the transform affect the text direction.


Whether to render using TeX, None means to use rcParams["text.usetex"] (default: False).


Set whether the text can be wrapped.
Wrapping does not work together with savefig(..., bbox_inches='tight') (which is also used internally by %matplotlib inline in IPython/Jupyter). The 'tight' setting rescales the canvas to accommodate all content and happens before wrapping.


Update this artist's properties from the dict props.


Update the location and the size of the bbox.
This method should be used when the position and size of the bbox needs to be updated before actually drawing the bbox.


Bases: matplotlib.path.Path
Create a path from the text.
Create a path from the text. Note that it simply is a path, not an artist. You need to use the PathPatch (or other artists) to draw this path onto the canvas.
Position of the text. For no offset, use xy=(0, 0).
The text to convert to a path.
Font size in points. Defaults to the size specified via the font properties prop.
Font property. If not provided, will use a default FontProperties with parameters from the rcParams.
(Currently ignored)
Whether to use tex rendering.
The following creates a path from the string "ABC" with Helvetica font face; and another path from the latex fraction 1/2:
Also see Using a text as a Path.
Return the codes
Get the text size.
Set the text size.
Return the cached path after updating it if necessary.
Bases: object
A class that converts strings to paths.
Parse mathtext string s and convert it to a (vertices, codes) pair.
Convert the string s to vertices and codes using usetex mode.
Convert string s to vertices and codes using the provided ttf font.
Return the cached TexManager instance.
Convert text s to path (a tuple of vertices and codes for matplotlib.path.Path).
The font properties for the text.
The text to be converted.
If True, use mathtext parser. If "TeX", use tex for rendering.
A list of numpy arrays containing the x and y coordinates of the vertices.
A list of path codes.
Create a list of vertices and codes from a text, and create a Path from those:
Also see TextPath for a more direct way to create a path from a text.


Bases: matplotlib.path.Path
Create a path from the text.
Create a path from the text. Note that it simply is a path, not an artist. You need to use the PathPatch (or other artists) to draw this path onto the canvas.
Position of the text. For no offset, use xy=(0, 0).
The text to convert to a path.
Font size in points. Defaults to the size specified via the font properties prop.
Font property. If not provided, will use a default FontProperties with parameters from the rcParams.
(Currently ignored)
Whether to use tex rendering.
The following creates a path from the string "ABC" with Helvetica font face; and another path from the latex fraction 1/2:
Also see Using a text as a Path.
Return the codes
Get the text size.
Set the text size.
Return the cached path after updating it if necessary.


Bases: object
A class that converts strings to paths.
Parse mathtext string s and convert it to a (vertices, codes) pair.
Convert the string s to vertices and codes using usetex mode.
Convert string s to vertices and codes using the provided ttf font.
Return the cached TexManager instance.
Convert text s to path (a tuple of vertices and codes for matplotlib.path.Path).
The font properties for the text.
The text to be converted.
If True, use mathtext parser. If "TeX", use tex for rendering.
A list of numpy arrays containing the x and y coordinates of the vertices.
A list of path codes.
Create a list of vertices and codes from a text, and create a Path from those:
Also see TextPath for a more direct way to create a path from a text.


Parse mathtext string s and convert it to a (vertices, codes) pair.


Convert the string s to vertices and codes using usetex mode.


Convert string s to vertices and codes using the provided ttf font.


Convert text s to path (a tuple of vertices and codes for matplotlib.path.Path).
The font properties for the text.
The text to be converted.
If True, use mathtext parser. If "TeX", use tex for rendering.
A list of numpy arrays containing the x and y coordinates of the vertices.
A list of path codes.
Create a list of vertices and codes from a text, and create a Path from those:
Also see TextPath for a more direct way to create a path from a text.


This module contains classes for configuring tick locating and formatting. Generic tick locators and formatters are provided, as well as domain specific custom ones.
Although the locators know nothing about major or minor ticks, they are used by the Axis class to support major and minor tick locating and formatting.
The Locator class is the base class for all tick locators. The locators handle autoscaling of the view limits based on the data limits, and the choosing of tick locations. A useful semi-automatic tick locator is MultipleLocator. It is initialized with a base, e.g., 10, and it picks axis limits and ticks that are multiples of that base.
The Locator subclasses defined here are:
AutoLocator
MaxNLocator with simple defaults. This is the default tick locator for most plotting.
MaxNLocator
Finds up to a max number of intervals with ticks at nice locations.
LinearLocator
Space ticks evenly from min to max.
LogLocator
Space ticks logarithmically from min to max.
MultipleLocator
Ticks and range are a multiple of base; either integer or float.
FixedLocator
Tick locations are fixed.
IndexLocator
Locator for index plots (e.g., where x = range(len(y))).
NullLocator
No ticks.
SymmetricalLogLocator
Locator for use with with the symlog norm; works like LogLocator for the part outside of the threshold and adds 0 if inside the limits.
LogitLocator
Locator for logit scaling.
AutoMinorLocator
Locator for minor ticks when the axis is linear and the major ticks are uniformly spaced. Subdivides the major tick interval into a specified number of minor intervals, defaulting to 4 or 5 depending on the major interval.
There are a number of locators specialized for date locations - see the dates module.
You can define your own locator by deriving from Locator. You must override the __call__ method, which returns a sequence of locations, and you will probably want to override the autoscale method to set the view limits from the data limits.
If you want to override the default locator, use one of the above or a custom locator and pass it to the x or y axis instance. The relevant methods are:
The default minor locator is NullLocator, i.e., no minor ticks on by default.
Note
Locator instances should not be used with more than one Axis or Axes. So instead of:
do the following instead:
Tick formatting is controlled by classes derived from Formatter. The formatter operates on a single tick value and returns a string to the axis.
NullFormatter
No labels on the ticks.
FixedFormatter
Set the strings manually for the labels.
FuncFormatter
User defined function sets the labels.
StrMethodFormatter
Use string format method.
FormatStrFormatter
Use an old-style sprintf format string.
ScalarFormatter
Default formatter for scalars: autopick the format string.
LogFormatter
Formatter for log axes.
LogFormatterExponent
Format values for log axis using exponent = log_base(value).
LogFormatterMathtext
Format values for log axis using exponent = log_base(value) using Math text.
LogFormatterSciNotation
Format values for log axis using scientific notation.
LogitFormatter
Probability formatter.
EngFormatter
Format labels in engineering notation.
PercentFormatter
Format labels as a percentage.
You can derive your own formatter from the Formatter base class by simply overriding the __call__ method. The formatter class has access to the axis view and data limits.
To control the major and minor tick label formats, use one of the following methods:
In addition to a Formatter instance, set_major_formatter and set_minor_formatter also accept a str or function. str input will be internally replaced with an autogenerated StrMethodFormatter with the input str. For function input, a FuncFormatter with the input function will be generated and used.
See Major and minor ticks for an example of setting major and minor ticks. See the matplotlib.dates module for more information and examples of using date locators and formatters.
Bases: matplotlib.ticker.MaxNLocator
Dynamically find major tick positions. This is actually a subclass of MaxNLocator, with parameters nbins = 'auto' and steps = [1, 2, 2.5, 5, 10].
To know the values of the non-public parameters, please have a look to the defaults of MaxNLocator.
Bases: matplotlib.ticker.Locator
Dynamically find minor tick positions based on the positions of major ticks. The scale must be linear with major ticks evenly spaced.
n is the number of subdivisions of the interval between major ticks; e.g., n=2 will place a single minor tick midway between major ticks.
If n is omitted or None, it will be set to 5 or 4.
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Bases: matplotlib.ticker.Formatter
Format axis values using engineering prefixes to represent powers of 1000, plus a specified unit, e.g., 10 MHz instead of 1e7.
Unit symbol to use, suitable for use with single-letter representations of powers of 1000. For example, 'Hz' or 'm'.
Precision with which to display the number, specified in digits after the decimal point (there will be between one and three digits before the decimal point). If it is None, the formatting falls back to the floating point format '%g', which displays up to 6 significant digits, i.e. the equivalent value for places varies between 0 and 5 (inclusive).
Separator used between the value and the prefix/unit. For example, one get '3.14 mV' if sep is " " (default) and '3.14mV' if sep is "". Besides the default behavior, some other useful options may be:
To enable/disable the use of TeX's math mode for rendering the numbers in the formatter.
To enable/disable the use mathtext for rendering the numbers in the formatter.
Format a number in engineering notation, appending a letter representing the power of 1000 of the original number. Some examples:
Bases: matplotlib.ticker.Formatter
Return fixed strings for tick labels based only on position, not value.
Note
FixedFormatter should only be used together with FixedLocator. Otherwise, the labels may end up in unexpected positions.
Set the sequence seq of strings that will be used for labels.
Bases: matplotlib.ticker.Locator
Tick locations are fixed. If nbins is not None, the array of possible positions will be subsampled to keep the number of ticks <= nbins +1. The subsampling will be done so as to include the smallest absolute value; for example, if zero is included in the array of possibilities, then it is guaranteed to be one of the chosen ticks.
Set parameters within this locator.
Return the locations of the ticks.
Note
Because the values are fixed, vmin and vmax are not used in this method.
Bases: matplotlib.ticker.Formatter
Use an old-style ('%' operator) format string to format the tick.
The format string should have a single variable format (%) in it. It will be applied to the value (not the position) of the tick.
Negative numeric values will use a dash not a unicode minus, use mathtext to get a unicode minus by wrappping the format specifier with $ (e.g. "$%g$").
Bases: matplotlib.ticker.TickHelper
Create a string based on a tick value and location.
Some classes may want to replace a hyphen for minus with the proper unicode symbol (U+2212) for typographical correctness. This is a helper method to perform such a replacement when it is enabled via rcParams["axes.unicode_minus"] (default: True).
Return the full string representation of the value with the position unspecified.
Return a short string version of the tick value.
Defaults to the position-independent long value.
Return the tick labels for all the ticks at once.
Set the locations of the ticks.
This method is called before computing the tick labels because some formatters need to know all tick locations to do so.
Bases: matplotlib.ticker.Formatter
Use a user-defined function for formatting.
The function should take in two inputs (a tick value x and a position pos), and return a string containing the corresponding tick label.
Bases: matplotlib.ticker.Locator
Place a tick on every multiple of some base number of points plotted, e.g., on every 5th point. It is assumed that you are doing index plotting; i.e., the axis is 0, len(data). This is mainly useful for x ticks.
Place ticks every base data point, starting at offset.
Set parameters within this locator
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Bases: matplotlib.ticker.Locator
Determine the tick locations
The first time this function is called it will try to set the number of ticks to make a nice tick partitioning. Thereafter the number of ticks will be fixed so that interactive navigation will be nice
Use presets to set locs based on lom. A dict mapping vmin, vmax->locs
Set parameters within this locator.
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Try to choose the view limits intelligently.
Bases: matplotlib.ticker.TickHelper
Determine the tick locations;
Note that the same locator should not be used across multiple Axis because the locator stores references to the Axis data and view limits.
Adjust a range as needed to avoid singularities.
This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not.
Log at WARNING level if locs is longer than Locator.MAXTICKS.
This is intended to be called immediately before returning locs from __call__ to inform users in case their Locator returns a huge number of ticks, causing Matplotlib to run out of memory.
The "strange" name of this method dates back to when it would raise an exception instead of emitting a log.
Do nothing, and raise a warning. Any locator class not supporting the set_params() function will call this.
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Select a scale for the range from vmin to vmax.
Subclasses should override this method to change locator behaviour.
Bases: matplotlib.ticker.Formatter
Base class for formatting ticks on a log or symlog scale.
It may be instantiated directly, or subclassed.
Base of the logarithm used in all calculations.
If True, label ticks only at integer powers of base. This is normally True for major ticks and False for minor ticks.
If labelOnlyBase is False, these two numbers control the labeling of ticks that are not at integer powers of base; normally these are the minor ticks. The controlling parameter is the log of the axis data range. In the typical case where base is 10 it is the number of decades spanned by the axis, so we can call it 'numdec'. If numdec <= all, all minor ticks will be labeled. If all < numdec <= subset, then only a subset of minor ticks will be labeled, so as to avoid crowding. If numdec > subset then no minor ticks will be labeled.
If a symmetric log scale is in use, its linthresh parameter must be supplied here.
The set_locs method must be called to enable the subsetting logic controlled by the minor_thresholds parameter.
In some cases such as the colorbar, there is no distinction between major and minor ticks; the tick locations might be set manually, or by a locator that puts ticks at integer powers of base and at intermediate locations. For this situation, disable the minor_thresholds logic by using minor_thresholds=(np.inf, np.inf), so that all ticks will be labeled.
To disable labeling of minor ticks when 'labelOnlyBase' is False, use minor_thresholds=(0, 0). This is the default for the "classic" style.
To label a subset of minor ticks when the view limits span up to 2 decades, and all of the ticks when zoomed in to 0.5 decades or less, use minor_thresholds=(2, 0.5).
To label all minor ticks when the view limits span up to 1.5 decades, use minor_thresholds=(1.5, 1.5).
Change the base for labeling.
Warning
Should always match the base used for LogLocator
Return the full string representation of the value with the position unspecified.
Return a short string version of the tick value.
Defaults to the position-independent long value.
Switch minor tick labeling on or off.
If True, label ticks only at integer powers of base.
Use axis view limits to control which ticks are labeled.
The locs parameter is ignored in the present algorithm.
Bases: matplotlib.ticker.LogFormatter
Format values for log axis using exponent = log_base(value).
Bases: matplotlib.ticker.LogFormatter
Format values for log axis using exponent = log_base(value).
Bases: matplotlib.ticker.LogFormatterMathtext
Format values following scientific notation in a logarithmic axis.
Bases: matplotlib.ticker.Locator
Determine the tick locations for log axes
Place ticks on the locations : subs[j] * base**i
The base of the log used, so ticks are placed at base**n.
Gives the multiples of integer powers of the base at which to place ticks. The default places ticks only at integer powers of the base. The permitted string values are 'auto' and 'all', both of which use an algorithm based on the axis view limits to determine whether and how to put ticks between integer powers of the base. With 'auto', ticks are placed only between integer powers; with 'all', the integer powers are included. A value of None is equivalent to 'auto'.
The maximum number of ticks to allow on a given axis. The default of None will try to choose intelligently as long as this Locator has already been assigned to an axis using get_tick_space, but otherwise falls back to 9.
Set the log base (major tick every base**i, i integer).
Adjust a range as needed to avoid singularities.
This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not.
Set parameters within this locator.
Set the minor ticks for the log scaling every base**i*subs[j].
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Try to choose the view limits intelligently.
Bases: matplotlib.ticker.Formatter
Probability formatter (using Math text).
If x > 1/2, with x = 1-v, indicate if x should be displayed as $overline{v}$. The default is to display $1-v$.
The string used to represent 1/2.
Indicate if the formatter is formatting minor ticks or not. Basically minor ticks are not labelled, except when only few ticks are provided, ticks with most space with neighbor ticks are labelled. See other parameters to change the default behavior.
Maximum number of locs for labelling some minor ticks. This parameter have no effect if minor is False.
Number of ticks which are labelled when the number of ticks is below the threshold.
Return a short string version of the tick value.
Defaults to the position-independent long value.
Set the locations of the ticks.
This method is called before computing the tick labels because some formatters need to know all tick locations to do so.
Set the number of minor ticks to label when some minor ticks are labelled.
Number of ticks which are labelled when the number of ticks is below the threshold.
Set the threshold for labelling minors ticks.
Maximum number of locations for labelling some minor ticks. This parameter have no effect if minor is False.
Set the way one half is displayed.
The string used to represent 1/2.
Switch display mode with overline for labelling p>1/2.
If x > 1/2, with x = 1-v, indicate if x should be displayed as $overline{v}$. The default is to display $1-v$.
Bases: matplotlib.ticker.MaxNLocator
Determine the tick locations for logit axes
Place ticks on the logit locations
Number of ticks. Only used if minor is False.
Indicate if this locator is for minor ticks or not.
Adjust a range as needed to avoid singularities.
This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not.
Set parameters within this locator.
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Bases: matplotlib.ticker.Locator
Find nice tick locations with no more than N being within the view limits. Locations beyond the limits are added to support autoscaling.
Maximum number of intervals; one less than max number of ticks. If the string 'auto', the number of bins will be automatically determined based on the length of the axis.
Sequence of nice numbers starting with 1 and ending with 10; e.g., [1, 2, 4, 5, 10], where the values are acceptable tick multiples. i.e. for the example, 20, 40, 60 would be an acceptable set of ticks, as would 0.4, 0.6, 0.8, because they are multiples of 2. However, 30, 60, 90 would not be allowed because 3 does not appear in the list of steps.
If True, ticks will take only integer values, provided at least min_n_ticks integers are found within the view limits.
If True, autoscaling will result in a range symmetric about zero.
Remove edge ticks -- useful for stacked or ganged plots where the upper tick of one axes overlaps with the lower tick of the axes above it, primarily when rcParams["axes.autolimit_mode"] (default: 'data') is 'round_numbers'. If prune=='lower', the smallest tick will be removed. If prune == 'upper', the largest tick will be removed. If prune == 'both', the largest and smallest ticks will be removed. If prune is None, no ticks will be removed.
Relax nbins and integer constraints if necessary to obtain this minimum number of ticks.
Set parameters for this locator.
see MaxNLocator
see MaxNLocator
see MaxNLocator
see MaxNLocator
see MaxNLocator
see MaxNLocator
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Select a scale for the range from vmin to vmax.
Subclasses should override this method to change locator behaviour.
Bases: matplotlib.ticker.Locator
Set a tick on each integer multiple of a base within the view interval.
Set parameters within this locator.
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Set the view limits to the nearest multiples of base that contain the data.
Bases: matplotlib.ticker.Formatter
Always return the empty string.
Bases: matplotlib.ticker.Locator
No ticks
Return the locations of the ticks.
Note
Because the values are Null, vmin and vmax are not used in this method.
Bases: matplotlib.ticker.Formatter
Format numbers as a percentage.
Determines how the number is converted into a percentage. xmax is the data value that corresponds to 100%. Percentages are computed as x / xmax * 100. So if the data is already scaled to be percentages, xmax will be 100. Another common situation is where xmax is 1.0.
The number of decimal places to place after the point. If None (the default), the number will be computed automatically.
A string that will be appended to the label. It may be None or empty to indicate that no symbol should be used. LaTeX special characters are escaped in symbol whenever latex mode is enabled, unless is_latex is True.
If False, reserved LaTeX characters in symbol will be escaped.
Format the number as a percentage number with the correct number of decimals and adds the percent symbol, if any.
If self.decimals is None, the number of digits after the decimal point is set based on the display_range of the axis as follows:
display_range
decimals
sample
>50
0
x = 34.5 => 35%
>5
1
x = 34.5 => 34.5%
>0.5
2
x = 34.5 => 34.50%
...
...
...
This method will not be very good for tiny axis ranges or extremely large ones. It assumes that the values on the chart are percentages displayed on a reasonable scale.
The configured percent symbol as a string.
If LaTeX is enabled via rcParams["text.usetex"] (default: False), the special characters {'#', '$', '%', '&', '~', '_', '^', '\', '{', '}'} are automatically escaped in the string.
Bases: matplotlib.ticker.Formatter
Format tick values as a number.
Whether to use offset notation. See set_useOffset.
Whether to use fancy math formatting. See set_useMathText.
Whether to use locale settings for decimal sign and positive sign. See set_useLocale.
In addition to the parameters above, the formatting of scientific vs. floating point representation can be configured via set_scientific and set_powerlimits).
Offset notation and scientific notation
Offset notation and scientific notation look quite similar at first sight. Both split some information from the formatted tick values and display it at the end of the axis.
The following plot with x limits 1_000_000 to 1_000_010 illustrates the different formatting. Note the labels at the right edge of the x axis.
(Source code, png, pdf)
Return the full string representation of the value with the position unspecified.
Return a short string version of the tick value.
Defaults to the position-independent long value.
Return scientific notation, plus offset.
Return whether locale settings are used for formatting.
See also
Return whether to use fancy math formatting.
See also
Return whether automatic mode for offset notation is active.
This returns True if set_useOffset(True); it returns False if an explicit offset was set, e.g. set_useOffset(1000).
See also
Set the locations of the ticks.
This method is called before computing the tick labels because some formatters need to know all tick locations to do so.
Set size thresholds for scientific notation.
A tuple (min_exp, max_exp) containing the powers of 10 that determine the switchover threshold. For a number representable as \(a \times 10^\mathrm{exp}\) with \(1 <= |a| < 10\), scientific notation will be used if exp <= min_exp or exp >= max_exp.
The default limits are controlled by rcParams["axes.formatter.limits"] (default: [-5, 6]).
In particular numbers with exp equal to the thresholds are written in scientific notation.
Typically, min_exp will be negative and max_exp will be positive.
For example, formatter.set_powerlimits((-3, 4)) will provide the following formatting: \(1 \times 10^{-3}, 9.9 \times 10^{-3}, 0.01,\) \(9999, 1 \times 10^4\).
See also
Turn scientific notation on or off.
See also
Set whether to use locale settings for decimal sign and positive sign.
None resets to rcParams["axes.formatter.use_locale"] (default: False).
Set whether to use fancy math formatting.
If active, scientific notation is formatted as \(1.2 \times 10^3\).
None resets to rcParams["axes.formatter.use_mathtext"] (default: False).
Set whether to use offset notation.
When formatting a set numbers whose value is large compared to their range, the formatter can separate an additive constant. This can shorten the formatted numbers so that they are less likely to overlap when drawn on an axis.
With active offset notation, the values
100_000, 100_002, 100_004, 100_006, 100_008
will be formatted as 0, 2, 4, 6, 8 plus an offset +1e5, which is written to the edge of the axis.
Return whether locale settings are used for formatting.
See also
Return whether to use fancy math formatting.
See also
Return whether automatic mode for offset notation is active.
This returns True if set_useOffset(True); it returns False if an explicit offset was set, e.g. set_useOffset(1000).
See also
Bases: matplotlib.ticker.Formatter
Use a new-style format string (as used by str.format) to format the tick.
The field used for the tick value must be labeled x and the field used for the tick position must be labeled pos.
Bases: matplotlib.ticker.Locator
Determine the tick locations for symmetric log axes.
If set, defines the base and linthresh of the symlog transform.
The base and linthresh of the symlog transform, as documented for SymmetricalLogScale. These parameters are only used if transform is not set.
The multiples of integer powers of the base where ticks are placed, i.e., ticks are placed at [sub * base**i for i in ... for sub in subs].
Either transform, or both base and linthresh, must be given.
Set parameters within this locator.
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Try to choose the view limits intelligently.
Bases: object
[Deprecated]
Deprecated since version 3.5:
[Deprecated]
Deprecated since version 3.5:
[Deprecated]
Deprecated since version 3.5:


Bases: matplotlib.ticker.MaxNLocator
Dynamically find major tick positions. This is actually a subclass of MaxNLocator, with parameters nbins = 'auto' and steps = [1, 2, 2.5, 5, 10].
To know the values of the non-public parameters, please have a look to the defaults of MaxNLocator.


Bases: matplotlib.ticker.Locator
Dynamically find minor tick positions based on the positions of major ticks. The scale must be linear with major ticks evenly spaced.
n is the number of subdivisions of the interval between major ticks; e.g., n=2 will place a single minor tick midway between major ticks.
If n is omitted or None, it will be set to 5 or 4.
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:


Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:


Bases: matplotlib.ticker.Formatter
Format axis values using engineering prefixes to represent powers of 1000, plus a specified unit, e.g., 10 MHz instead of 1e7.
Unit symbol to use, suitable for use with single-letter representations of powers of 1000. For example, 'Hz' or 'm'.
Precision with which to display the number, specified in digits after the decimal point (there will be between one and three digits before the decimal point). If it is None, the formatting falls back to the floating point format '%g', which displays up to 6 significant digits, i.e. the equivalent value for places varies between 0 and 5 (inclusive).
Separator used between the value and the prefix/unit. For example, one get '3.14 mV' if sep is " " (default) and '3.14mV' if sep is "". Besides the default behavior, some other useful options may be:
To enable/disable the use of TeX's math mode for rendering the numbers in the formatter.
To enable/disable the use mathtext for rendering the numbers in the formatter.
Format a number in engineering notation, appending a letter representing the power of 1000 of the original number. Some examples:


Format a number in engineering notation, appending a letter representing the power of 1000 of the original number. Some examples:


Bases: matplotlib.ticker.Formatter
Return fixed strings for tick labels based only on position, not value.
Note
FixedFormatter should only be used together with FixedLocator. Otherwise, the labels may end up in unexpected positions.
Set the sequence seq of strings that will be used for labels.


Bases: matplotlib.ticker.Locator
Tick locations are fixed. If nbins is not None, the array of possible positions will be subsampled to keep the number of ticks <= nbins +1. The subsampling will be done so as to include the smallest absolute value; for example, if zero is included in the array of possibilities, then it is guaranteed to be one of the chosen ticks.
Set parameters within this locator.
Return the locations of the ticks.
Note
Because the values are fixed, vmin and vmax are not used in this method.


Return the locations of the ticks.
Note
Because the values are fixed, vmin and vmax are not used in this method.


Bases: matplotlib.ticker.Formatter
Use an old-style ('%' operator) format string to format the tick.
The format string should have a single variable format (%) in it. It will be applied to the value (not the position) of the tick.
Negative numeric values will use a dash not a unicode minus, use mathtext to get a unicode minus by wrappping the format specifier with $ (e.g. "$%g$").


Bases: matplotlib.ticker.TickHelper
Create a string based on a tick value and location.
Some classes may want to replace a hyphen for minus with the proper unicode symbol (U+2212) for typographical correctness. This is a helper method to perform such a replacement when it is enabled via rcParams["axes.unicode_minus"] (default: True).
Return the full string representation of the value with the position unspecified.
Return a short string version of the tick value.
Defaults to the position-independent long value.
Return the tick labels for all the ticks at once.
Set the locations of the ticks.
This method is called before computing the tick labels because some formatters need to know all tick locations to do so.


Some classes may want to replace a hyphen for minus with the proper unicode symbol (U+2212) for typographical correctness. This is a helper method to perform such a replacement when it is enabled via rcParams["axes.unicode_minus"] (default: True).


Return the full string representation of the value with the position unspecified.


Return a short string version of the tick value.
Defaults to the position-independent long value.


Return the tick labels for all the ticks at once.


Set the locations of the ticks.
This method is called before computing the tick labels because some formatters need to know all tick locations to do so.


Bases: matplotlib.ticker.Formatter
Use a user-defined function for formatting.
The function should take in two inputs (a tick value x and a position pos), and return a string containing the corresponding tick label.


Bases: matplotlib.ticker.Locator
Place a tick on every multiple of some base number of points plotted, e.g., on every 5th point. It is assumed that you are doing index plotting; i.e., the axis is 0, len(data). This is mainly useful for x ticks.
Place ticks every base data point, starting at offset.
Set parameters within this locator
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:


Bases: matplotlib.ticker.Locator
Determine the tick locations
The first time this function is called it will try to set the number of ticks to make a nice tick partitioning. Thereafter the number of ticks will be fixed so that interactive navigation will be nice
Use presets to set locs based on lom. A dict mapping vmin, vmax->locs
Set parameters within this locator.
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Try to choose the view limits intelligently.


Try to choose the view limits intelligently.


Bases: matplotlib.ticker.TickHelper
Determine the tick locations;
Note that the same locator should not be used across multiple Axis because the locator stores references to the Axis data and view limits.
Adjust a range as needed to avoid singularities.
This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not.
Log at WARNING level if locs is longer than Locator.MAXTICKS.
This is intended to be called immediately before returning locs from __call__ to inform users in case their Locator returns a huge number of ticks, causing Matplotlib to run out of memory.
The "strange" name of this method dates back to when it would raise an exception instead of emitting a log.
Do nothing, and raise a warning. Any locator class not supporting the set_params() function will call this.
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Select a scale for the range from vmin to vmax.
Subclasses should override this method to change locator behaviour.


Adjust a range as needed to avoid singularities.
This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not.


Log at WARNING level if locs is longer than Locator.MAXTICKS.
This is intended to be called immediately before returning locs from __call__ to inform users in case their Locator returns a huge number of ticks, causing Matplotlib to run out of memory.
The "strange" name of this method dates back to when it would raise an exception instead of emitting a log.


Do nothing, and raise a warning. Any locator class not supporting the set_params() function will call this.


Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:


Select a scale for the range from vmin to vmax.
Subclasses should override this method to change locator behaviour.


Bases: matplotlib.ticker.Formatter
Base class for formatting ticks on a log or symlog scale.
It may be instantiated directly, or subclassed.
Base of the logarithm used in all calculations.
If True, label ticks only at integer powers of base. This is normally True for major ticks and False for minor ticks.
If labelOnlyBase is False, these two numbers control the labeling of ticks that are not at integer powers of base; normally these are the minor ticks. The controlling parameter is the log of the axis data range. In the typical case where base is 10 it is the number of decades spanned by the axis, so we can call it 'numdec'. If numdec <= all, all minor ticks will be labeled. If all < numdec <= subset, then only a subset of minor ticks will be labeled, so as to avoid crowding. If numdec > subset then no minor ticks will be labeled.
If a symmetric log scale is in use, its linthresh parameter must be supplied here.
The set_locs method must be called to enable the subsetting logic controlled by the minor_thresholds parameter.
In some cases such as the colorbar, there is no distinction between major and minor ticks; the tick locations might be set manually, or by a locator that puts ticks at integer powers of base and at intermediate locations. For this situation, disable the minor_thresholds logic by using minor_thresholds=(np.inf, np.inf), so that all ticks will be labeled.
To disable labeling of minor ticks when 'labelOnlyBase' is False, use minor_thresholds=(0, 0). This is the default for the "classic" style.
To label a subset of minor ticks when the view limits span up to 2 decades, and all of the ticks when zoomed in to 0.5 decades or less, use minor_thresholds=(2, 0.5).
To label all minor ticks when the view limits span up to 1.5 decades, use minor_thresholds=(1.5, 1.5).
Change the base for labeling.
Warning
Should always match the base used for LogLocator
Return the full string representation of the value with the position unspecified.
Return a short string version of the tick value.
Defaults to the position-independent long value.
Switch minor tick labeling on or off.
If True, label ticks only at integer powers of base.
Use axis view limits to control which ticks are labeled.
The locs parameter is ignored in the present algorithm.


Change the base for labeling.
Warning
Should always match the base used for LogLocator


Switch minor tick labeling on or off.
If True, label ticks only at integer powers of base.


Use axis view limits to control which ticks are labeled.
The locs parameter is ignored in the present algorithm.


Bases: matplotlib.ticker.LogFormatter
Format values for log axis using exponent = log_base(value).


Bases: matplotlib.ticker.LogFormatterMathtext
Format values following scientific notation in a logarithmic axis.


Bases: matplotlib.ticker.Formatter
Probability formatter (using Math text).
If x > 1/2, with x = 1-v, indicate if x should be displayed as $overline{v}$. The default is to display $1-v$.
The string used to represent 1/2.
Indicate if the formatter is formatting minor ticks or not. Basically minor ticks are not labelled, except when only few ticks are provided, ticks with most space with neighbor ticks are labelled. See other parameters to change the default behavior.
Maximum number of locs for labelling some minor ticks. This parameter have no effect if minor is False.
Number of ticks which are labelled when the number of ticks is below the threshold.
Return a short string version of the tick value.
Defaults to the position-independent long value.
Set the locations of the ticks.
This method is called before computing the tick labels because some formatters need to know all tick locations to do so.
Set the number of minor ticks to label when some minor ticks are labelled.
Number of ticks which are labelled when the number of ticks is below the threshold.
Set the threshold for labelling minors ticks.
Maximum number of locations for labelling some minor ticks. This parameter have no effect if minor is False.
Set the way one half is displayed.
The string used to represent 1/2.
Switch display mode with overline for labelling p>1/2.
If x > 1/2, with x = 1-v, indicate if x should be displayed as $overline{v}$. The default is to display $1-v$.


Return a short string version of the tick value.
Defaults to the position-independent long value.


Set the locations of the ticks.
This method is called before computing the tick labels because some formatters need to know all tick locations to do so.


Set the number of minor ticks to label when some minor ticks are labelled.
Number of ticks which are labelled when the number of ticks is below the threshold.


Set the threshold for labelling minors ticks.
Maximum number of locations for labelling some minor ticks. This parameter have no effect if minor is False.


Set the way one half is displayed.
The string used to represent 1/2.


Switch display mode with overline for labelling p>1/2.
If x > 1/2, with x = 1-v, indicate if x should be displayed as $overline{v}$. The default is to display $1-v$.


Bases: matplotlib.ticker.MaxNLocator
Determine the tick locations for logit axes
Place ticks on the logit locations
Number of ticks. Only used if minor is False.
Indicate if this locator is for minor ticks or not.
Adjust a range as needed to avoid singularities.
This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not.
Set parameters within this locator.
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:


Adjust a range as needed to avoid singularities.
This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not.


Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:


Bases: matplotlib.ticker.Locator
Determine the tick locations for log axes
Place ticks on the locations : subs[j] * base**i
The base of the log used, so ticks are placed at base**n.
Gives the multiples of integer powers of the base at which to place ticks. The default places ticks only at integer powers of the base. The permitted string values are 'auto' and 'all', both of which use an algorithm based on the axis view limits to determine whether and how to put ticks between integer powers of the base. With 'auto', ticks are placed only between integer powers; with 'all', the integer powers are included. A value of None is equivalent to 'auto'.
The maximum number of ticks to allow on a given axis. The default of None will try to choose intelligently as long as this Locator has already been assigned to an axis using get_tick_space, but otherwise falls back to 9.
Set the log base (major tick every base**i, i integer).
Adjust a range as needed to avoid singularities.
This method gets called during autoscaling, with (v0, v1) set to the data limits on the axes if the axes contains any data, or (-inf, +inf) if not.
Set parameters within this locator.
Set the minor ticks for the log scaling every base**i*subs[j].
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Try to choose the view limits intelligently.


Set the log base (major tick every base**i, i integer).


Set the minor ticks for the log scaling every base**i*subs[j].


Try to choose the view limits intelligently.


Bases: matplotlib.ticker.Locator
Find nice tick locations with no more than N being within the view limits. Locations beyond the limits are added to support autoscaling.
Maximum number of intervals; one less than max number of ticks. If the string 'auto', the number of bins will be automatically determined based on the length of the axis.
Sequence of nice numbers starting with 1 and ending with 10; e.g., [1, 2, 4, 5, 10], where the values are acceptable tick multiples. i.e. for the example, 20, 40, 60 would be an acceptable set of ticks, as would 0.4, 0.6, 0.8, because they are multiples of 2. However, 30, 60, 90 would not be allowed because 3 does not appear in the list of steps.
If True, ticks will take only integer values, provided at least min_n_ticks integers are found within the view limits.
If True, autoscaling will result in a range symmetric about zero.
Remove edge ticks -- useful for stacked or ganged plots where the upper tick of one axes overlaps with the lower tick of the axes above it, primarily when rcParams["axes.autolimit_mode"] (default: 'data') is 'round_numbers'. If prune=='lower', the smallest tick will be removed. If prune == 'upper', the largest tick will be removed. If prune == 'both', the largest and smallest ticks will be removed. If prune is None, no ticks will be removed.
Relax nbins and integer constraints if necessary to obtain this minimum number of ticks.
Set parameters for this locator.
see MaxNLocator
see MaxNLocator
see MaxNLocator
see MaxNLocator
see MaxNLocator
see MaxNLocator
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Select a scale for the range from vmin to vmax.
Subclasses should override this method to change locator behaviour.


Set parameters for this locator.
see MaxNLocator
see MaxNLocator
see MaxNLocator
see MaxNLocator
see MaxNLocator
see MaxNLocator


Select a scale for the range from vmin to vmax.
Subclasses should override this method to change locator behaviour.


Bases: matplotlib.ticker.Locator
Set a tick on each integer multiple of a base within the view interval.
Set parameters within this locator.
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Set the view limits to the nearest multiples of base that contain the data.


Set the view limits to the nearest multiples of base that contain the data.


Bases: matplotlib.ticker.Formatter
Always return the empty string.


Bases: matplotlib.ticker.Locator
No ticks
Return the locations of the ticks.
Note
Because the values are Null, vmin and vmax are not used in this method.


Return the locations of the ticks.
Note
Because the values are Null, vmin and vmax are not used in this method.


Bases: matplotlib.ticker.Formatter
Format numbers as a percentage.
Determines how the number is converted into a percentage. xmax is the data value that corresponds to 100%. Percentages are computed as x / xmax * 100. So if the data is already scaled to be percentages, xmax will be 100. Another common situation is where xmax is 1.0.
The number of decimal places to place after the point. If None (the default), the number will be computed automatically.
A string that will be appended to the label. It may be None or empty to indicate that no symbol should be used. LaTeX special characters are escaped in symbol whenever latex mode is enabled, unless is_latex is True.
If False, reserved LaTeX characters in symbol will be escaped.
Format the number as a percentage number with the correct number of decimals and adds the percent symbol, if any.
If self.decimals is None, the number of digits after the decimal point is set based on the display_range of the axis as follows:
display_range
decimals
sample
>50
0
x = 34.5 => 35%
>5
1
x = 34.5 => 34.5%
>0.5
2
x = 34.5 => 34.50%
...
...
...
This method will not be very good for tiny axis ranges or extremely large ones. It assumes that the values on the chart are percentages displayed on a reasonable scale.
The configured percent symbol as a string.
If LaTeX is enabled via rcParams["text.usetex"] (default: False), the special characters {'#', '$', '%', '&', '~', '_', '^', '\', '{', '}'} are automatically escaped in the string.


Format the number as a percentage number with the correct number of decimals and adds the percent symbol, if any.
If self.decimals is None, the number of digits after the decimal point is set based on the display_range of the axis as follows:
display_range
decimals
sample
>50
0
x = 34.5 => 35%
>5
1
x = 34.5 => 34.5%
>0.5
2
x = 34.5 => 34.50%
...
...
...
This method will not be very good for tiny axis ranges or extremely large ones. It assumes that the values on the chart are percentages displayed on a reasonable scale.