matplotlib.ticker
Tick locating and formatting
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.
Tick locating
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
|
NullLocator |
No ticks. |
SymmetricalLogLocator |
Locator for use with the symlog norm; works like LogLocator for the part outside of the threshold and adds 0 if inside the limits. |
AsinhLocator |
Locator for use with the asinh norm, attempting to space ticks approximately uniformly. |
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:
ax.xaxis.set_major_locator(xmajor_locator)
ax.xaxis.set_minor_locator(xminor_locator)
ax.yaxis.set_major_locator(ymajor_locator)
ax.yaxis.set_minor_locator(yminor_locator)
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 ~matplotlib.axis.Axis or ~matplotlib.axes.Axes. So instead of:
locator = MultipleLocator(5)
ax.xaxis.set_major_locator(locator)
ax2.xaxis.set_major_locator(locator)
do the following instead:
ax.xaxis.set_major_locator(MultipleLocator(5))
ax2.xaxis.set_major_locator(MultipleLocator(5))
Tick formatting
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
|
LogFormatterMathtext |
Format values for log axis using
|
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:
ax.xaxis.set_major_formatter(xmajor_formatter)
ax.xaxis.set_minor_formatter(xminor_formatter)
ax.yaxis.set_major_formatter(ymajor_formatter)
ax.yaxis.set_minor_formatter(yminor_formatter)
In addition to a .Formatter instance, ~.Axis.set_major_formatter and
~.Axis.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 /gallery/ticks/major_minor_demo 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.
Classes
TickHelper
: Undocumented.Formatter
: Create a string based on a tick value and location.FixedFormatter
: Return fixed strings for tick labels based only on position, not value.NullFormatter
: Always return the empty string.FuncFormatter
: Use a user-defined function for formatting.FormatStrFormatter
: Use an old-style (‘%’ operator) format string to format the tick.StrMethodFormatter
: Use a new-style format string (as used by str.format) to format the tick.ScalarFormatter
: Format tick values as a number.LogFormatter
: Base class for formatting ticks on a log or symlog scale.LogFormatterExponent
: Format values for log axis usingexponent = log_base(value)
.LogFormatterMathtext
: Format values for log axis usingexponent = log_base(value)
.LogFormatterSciNotation
: Format values following scientific notation in a logarithmic axis.LogitFormatter
: Probability formatter (using Math text).EngFormatter
: Format axis values using engineering prefixes to represent powersPercentFormatter
: Format numbers as a percentage.Locator
: Determine the tick locations;IndexLocator
: Place a tick on every multiple of some base number of pointsFixedLocator
: Tick locations are fixed at locs. If nbins is not None,NullLocator
: No ticksLinearLocator
: Determine the tick locationsLogLocator
: Determine the tick locations for log axes.AutoLocator
: Dynamically find major tick positions. This is actually a subclassMultipleLocator
: Set a tick on each integer multiple of the base within the viewMaxNLocator
: Find nice tick locations with no more than nbins + 1 being within theAutoMinorLocator
: Dynamically find minor tick positions based on the positions ofSymmetricalLogLocator
: Determine the tick locations for symmetric log axes.AsinhLocator
: An axis tick locator specialized for the inverse-sinh scaleLogitLocator
: Determine the tick locations for logit axes
- class matplotlib.ticker.TickHelper
Inheritance
digraph inheritance5d450f71c7 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }
- class matplotlib.ticker.Formatter
Create a string based on a tick value and location.
Inheritance
digraph inheritance95f7165e66 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- static fix_minus(s)
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 :rc:`axes.unicode_minus`.
- format_data(value)
Return the full string representation of the value with the position unspecified.
- format_data_short(value)
Return a short string version of the tick value.
Defaults to the position-independent long value.
- format_ticks(values)
Return the tick labels for all the ticks at once.
- set_locs(locs)
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.
- class matplotlib.ticker.FixedFormatter(seq)
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.
Inheritance
digraph inheritance67ec8df651 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "FixedFormatter" [URL="#matplotlib.ticker.FixedFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Return fixed strings for tick labels based only on position, not value."]; "Formatter" -> "FixedFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }
- class matplotlib.ticker.NullFormatter
Always return the empty string.
Inheritance
digraph inheritance0ca12f2030 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NullFormatter" [URL="#matplotlib.ticker.NullFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Always return the empty string."]; "Formatter" -> "NullFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }
- class matplotlib.ticker.FuncFormatter(func)
Use a user-defined function for formatting.
The function should take in two inputs (a tick value
x
and a positionpos
), and return a string containing the corresponding tick label.Inheritance
digraph inheritance79e401d30a { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "FuncFormatter" [URL="#matplotlib.ticker.FuncFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Use a user-defined function for formatting."]; "Formatter" -> "FuncFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }
- class matplotlib.ticker.FormatStrFormatter(fmt)
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 wrapping the format specifier with $ (e.g. “$%g$”).
Inheritance
digraph inheritance5f46aeceec { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "FormatStrFormatter" [URL="#matplotlib.ticker.FormatStrFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Use an old-style ('%' operator) format string to format the tick."]; "Formatter" -> "FormatStrFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }
- class matplotlib.ticker.StrMethodFormatter(fmt)
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.
Inheritance
digraph inheritance11f5959d7e { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "StrMethodFormatter" [URL="#matplotlib.ticker.StrMethodFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Use a new-style format string (as used by `str.format`) to format the tick."]; "Formatter" -> "StrMethodFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }
- class matplotlib.ticker.ScalarFormatter(useOffset=None, useMathText=None, useLocale=None)
Format tick values as a number.
- Parameters:
useOffset (bool or float, default: :rc:`axes.formatter.useoffset`) – Whether to use offset notation. See .set_useOffset.
useMathText (bool, default: :rc:`axes.formatter.use_mathtext`) – Whether to use fancy math formatting. See .set_useMathText.
useLocale (bool, default: :rc:`axes.formatter.use_locale`.) – Whether to use locale settings for decimal sign and positive sign. See .set_useLocale.
Notes
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 scientific notation splits up the order of magnitude, i.e. a multiplicative scaling factor, e.g.
1e6
.The offset notation separates an additive constant, e.g.
+1e6
. The offset notation label is always prefixed with a+
or-
sign and is thus distinguishable from the order of magnitude label.
The following plot with x limits
1_000_000
to1_000_010
illustrates the different formatting. Note the labels at the right edge of the x axis.Inheritance
digraph inheritance3a63b93a3d { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ScalarFormatter" [URL="#matplotlib.ticker.ScalarFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Format tick values as a number."]; "Formatter" -> "ScalarFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- format_data(value)
Return the full string representation of the value with the position unspecified.
- format_data_short(value)
Return a short string version of the tick value.
Defaults to the position-independent long value.
- get_offset()
Return scientific notation, plus offset.
- get_useLocale()
Return whether locale settings are used for formatting.
See also
- get_useMathText()
Return whether to use fancy math formatting.
See also
- get_useOffset()
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_locs(locs)
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_powerlimits(lims)
Set size thresholds for scientific notation.
- Parameters:
lims ((int, int)) –
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
orexp >= max_exp
.The default limits are controlled by :rc:`axes.formatter.limits`.
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
- set_scientific(b)
Turn scientific notation on or off.
See also
- set_useLocale(val)
Set whether to use locale settings for decimal sign and positive sign.
- Parameters:
val (bool or None) – None resets to :rc:`axes.formatter.use_locale`.
- set_useMathText(val)
Set whether to use fancy math formatting.
If active, scientific notation is formatted as \(1.2 \times 10^3\).
- Parameters:
val (bool or None) – None resets to :rc:`axes.formatter.use_mathtext`.
- set_useOffset(val)
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.
- Parameters:
val (bool or float) –
If False, do not use offset notation.
If True (=automatic mode), use offset notation if it can make the residual numbers significantly shorter. The exact behavior is controlled by :rc:`axes.formatter.offset_threshold`.
If a number, force an offset of the given value.
Examples
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.
- property useLocale
Return whether locale settings are used for formatting.
See also
- property useMathText
Return whether to use fancy math formatting.
See also
- property useOffset
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
- class matplotlib.ticker.LogFormatter(base=10.0, labelOnlyBase=False, minor_thresholds=None, linthresh=None)
Base class for formatting ticks on a log or symlog scale.
It may be instantiated directly, or subclassed.
- Parameters:
base (float, default: 10.) – Base of the logarithm used in all calculations.
labelOnlyBase (bool, default: False) – If True, label ticks only at integer powers of base. This is normally True for major ticks and False for minor ticks.
minor_thresholds ((subset, all), default: (1, 0.4)) – 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. Ifall < numdec <= subset
, then only a subset of minor ticks will be labeled, so as to avoid crowding. Ifnumdec > subset
then no minor ticks will be labeled.linthresh (None or float, default: None) – If a symmetric log scale is in use, its
linthresh
parameter must be supplied here.
Notes
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.Examples
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)
.Inheritance
digraph inheritance6d16acd81c { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LogFormatter" [URL="#matplotlib.ticker.LogFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for formatting ticks on a log or symlog scale."]; "Formatter" -> "LogFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- base(base)
[Deprecated] Change the base for labeling.
Warning
Should always match the base used for
LogLocator
Notes
Deprecated since version 3.6: Use set_base() instead.
- format_data(value)
Return the full string representation of the value with the position unspecified.
- format_data_short(value)
Return a short string version of the tick value.
Defaults to the position-independent long value.
- label_minor(labelOnlyBase)
[Deprecated] Switch minor tick labeling on or off.
- Parameters:
labelOnlyBase (bool) – If True, label ticks only at integer powers of base.
Notes
Deprecated since version 3.6: Use set_label_minor() instead.
- set_base(base)
Change the base for labeling.
Warning
Should always match the base used for
LogLocator
- set_label_minor(labelOnlyBase)
Switch minor tick labeling on or off.
- Parameters:
labelOnlyBase (bool) – If True, label ticks only at integer powers of base.
- set_locs(locs=None)
Use axis view limits to control which ticks are labeled.
The locs parameter is ignored in the present algorithm.
- class matplotlib.ticker.LogFormatterExponent(base=10.0, labelOnlyBase=False, minor_thresholds=None, linthresh=None)
Format values for log axis using
exponent = log_base(value)
.Inheritance
digraph inheritance7a7a333a32 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LogFormatter" [URL="#matplotlib.ticker.LogFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for formatting ticks on a log or symlog scale."]; "Formatter" -> "LogFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LogFormatterExponent" [URL="#matplotlib.ticker.LogFormatterExponent",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Format values for log axis using ``exponent = log_base(value)``."]; "LogFormatter" -> "LogFormatterExponent" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }
- class matplotlib.ticker.LogFormatterMathtext(base=10.0, labelOnlyBase=False, minor_thresholds=None, linthresh=None)
Format values for log axis using
exponent = log_base(value)
.Inheritance
digraph inheritance23d141794a { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LogFormatter" [URL="#matplotlib.ticker.LogFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for formatting ticks on a log or symlog scale."]; "Formatter" -> "LogFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LogFormatterMathtext" [URL="#matplotlib.ticker.LogFormatterMathtext",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Format values for log axis using ``exponent = log_base(value)``."]; "LogFormatter" -> "LogFormatterMathtext" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }
- class matplotlib.ticker.LogFormatterSciNotation(base=10.0, labelOnlyBase=False, minor_thresholds=None, linthresh=None)
Format values following scientific notation in a logarithmic axis.
Inheritance
digraph inheritance412ca31cea { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LogFormatter" [URL="#matplotlib.ticker.LogFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for formatting ticks on a log or symlog scale."]; "Formatter" -> "LogFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LogFormatterMathtext" [URL="#matplotlib.ticker.LogFormatterMathtext",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Format values for log axis using ``exponent = log_base(value)``."]; "LogFormatter" -> "LogFormatterMathtext" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LogFormatterSciNotation" [URL="#matplotlib.ticker.LogFormatterSciNotation",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Format values following scientific notation in a logarithmic axis."]; "LogFormatterMathtext" -> "LogFormatterSciNotation" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }
- class matplotlib.ticker.LogitFormatter(*, use_overline=False, one_half='\\frac{1}{2}', minor=False, minor_threshold=25, minor_number=6)
Probability formatter (using Math text).
Inheritance
digraph inheritance21fea23ec5 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LogitFormatter" [URL="#matplotlib.ticker.LogitFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Probability formatter (using Math text)."]; "Formatter" -> "LogitFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- format_data_short(value)
Return a short string version of the tick value.
Defaults to the position-independent long value.
- set_locs(locs)
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_minor_number(minor_number)
Set the number of minor ticks to label when some minor ticks are labelled.
- Parameters:
minor_number (int) – Number of ticks which are labelled when the number of ticks is below the threshold.
- set_minor_threshold(minor_threshold)
Set the threshold for labelling minors ticks.
- Parameters:
minor_threshold (int) – Maximum number of locations for labelling some minor ticks. This parameter have no effect if minor is False.
- set_one_half(one_half)
Set the way one half is displayed.
- one_halfstr, default: r”frac{1}{2}”
The string used to represent 1/2.
- use_overline(use_overline)
Switch display mode with overline for labelling p>1/2.
- Parameters:
use_overline (bool, default: False) – If x > 1/2, with x = 1-v, indicate if x should be displayed as $overline{v}$. The default is to display $1-v$.
- class matplotlib.ticker.EngFormatter(unit='', places=None, sep=' ', *, usetex=None, useMathText=None)
Format axis values using engineering prefixes to represent powers of 1000, plus a specified unit, e.g., 10 MHz instead of 1e7.
Inheritance
digraph inheritance3a303e6021 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "EngFormatter" [URL="#matplotlib.ticker.EngFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Format axis values using engineering prefixes to represent powers"]; "Formatter" -> "EngFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- format_eng(num)
Format a number in engineering notation, appending a letter representing the power of 1000 of the original number. Some examples:
>>> format_eng(0) # for self.places = 0 '0'
>>> format_eng(1000000) # for self.places = 1 '1.0 M'
>>> format_eng(-1e-6) # for self.places = 2 '-1.00 µ'
- class matplotlib.ticker.PercentFormatter(xmax=100, decimals=None, symbol='%', is_latex=False)
Format numbers as a percentage.
- Parameters:
xmax (float) – 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.decimals (None or int) – The number of decimal places to place after the point. If None (the default), the number will be computed automatically.
symbol (str or None) – 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.
is_latex (bool) – If False, reserved LaTeX characters in symbol will be escaped.
Inheritance
digraph inheritance5741873cc6 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Formatter" [URL="#matplotlib.ticker.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a string based on a tick value and location."]; "TickHelper" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PercentFormatter" [URL="#matplotlib.ticker.PercentFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Format numbers as a percentage."]; "Formatter" -> "PercentFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- format_pct(x, display_range)
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.
- property symbol
The configured percent symbol as a string.
If LaTeX is enabled via :rc:`text.usetex`, the special characters
{'#', '$', '%', '&', '~', '_', '^', '\', '{', '}'}
are automatically escaped in the string.
- class matplotlib.ticker.Locator
Determine the tick locations;
Note that the same locator should not be used across multiple ~matplotlib.axis.Axis because the locator stores references to the Axis data and view limits.
Inheritance
digraph inheritancecd0315be70 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- nonsingular(v0, v1)
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.If
v0 == v1
(possibly up to some floating point slop), this method returns an expanded interval around this value.If
(v0, v1) == (-inf, +inf)
, this method returns appropriate default view limits.Otherwise,
(v0, v1)
is returned without modification.
- raise_if_exceeds(locs)
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.
- set_params(**kwargs)
Do nothing, and raise a warning. Any locator class not supporting the set_params() function will call this.
- tick_values(vmin, vmax)
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:>>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
- view_limits(vmin, vmax)
Select a scale for the range from vmin to vmax.
Subclasses should override this method to change locator behaviour.
- class matplotlib.ticker.IndexLocator(base, offset)
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.
Inheritance
digraph inheritance027b080f3b { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "IndexLocator" [URL="#matplotlib.ticker.IndexLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Place a tick on every multiple of some base number of points"]; "Locator" -> "IndexLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- set_params(base=None, offset=None)
Set parameters within this locator
- tick_values(vmin, vmax)
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:>>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
- class matplotlib.ticker.FixedLocator(locs, nbins=None)
Tick locations are fixed at locs. If nbins is not None, the locs array of possible positions will be subsampled to keep the number of ticks <= nbins +1. The subsampling will be done 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.
Inheritance
digraph inheritanceb1c9735013 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "FixedLocator" [URL="#matplotlib.ticker.FixedLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Tick locations are fixed at *locs*. If *nbins* is not None,"]; "Locator" -> "FixedLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- set_params(nbins=None)
Set parameters within this locator.
- tick_values(vmin, vmax)
Return the locations of the ticks.
Note
Because the values are fixed, vmin and vmax are not used in this method.
- class matplotlib.ticker.NullLocator
No ticks
Inheritance
digraph inheritance5abe6000b7 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NullLocator" [URL="#matplotlib.ticker.NullLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="No ticks"]; "Locator" -> "NullLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- tick_values(vmin, vmax)
Return the locations of the ticks.
Note
Because the values are Null, vmin and vmax are not used in this method.
- class matplotlib.ticker.LinearLocator(numticks=None, presets=None)
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
Inheritance
digraph inheritance905578815b { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "LinearLocator" [URL="#matplotlib.ticker.LinearLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations"]; "Locator" -> "LinearLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- set_params(numticks=None, presets=None)
Set parameters within this locator.
- tick_values(vmin, vmax)
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:>>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
- view_limits(vmin, vmax)
Try to choose the view limits intelligently.
- class matplotlib.ticker.LogLocator(base=10.0, subs=(1.0,), numdecs=4, numticks=None)
Determine the tick locations for log axes.
Place ticks on the locations :
subs[j] * base**i
- Parameters:
base (float, default: 10.0) – The base of the log used, so major ticks are placed at
base**n
, wheren
is an integer.subs (None or {'auto', 'all'} or sequence of float, default: (1.0,)) – Gives the multiples of integer powers of the base at which to place ticks. The default of
(1.0, )
places ticks only at integer powers of the base. Permitted string values are'auto'
and'all'
. Both of these 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'
.numticks (None or int, default: None) – 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 ~.axis.Axis.get_tick_space, but otherwise falls back to 9.
Inheritance
digraph inheritancede3c3d1df0 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LogLocator" [URL="#matplotlib.ticker.LogLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations for log axes."]; "Locator" -> "LogLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- base(base)
[Deprecated] Set the log base (major tick every
base**i
, i integer).Notes
Deprecated since version 3.6: Use set_params(base=…) instead.
- nonsingular(vmin, vmax)
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.If
v0 == v1
(possibly up to some floating point slop), this method returns an expanded interval around this value.If
(v0, v1) == (-inf, +inf)
, this method returns appropriate default view limits.Otherwise,
(v0, v1)
is returned without modification.
- set_params(base=None, subs=None, numdecs=None, numticks=None)
Set parameters within this locator.
- subs(subs)
[Deprecated] Set the minor ticks for the log scaling every
base**i*subs[j]
.Notes
Deprecated since version 3.6: Use set_params(subs=…) instead.
- tick_values(vmin, vmax)
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:>>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
- view_limits(vmin, vmax)
Try to choose the view limits intelligently.
- class matplotlib.ticker.AutoLocator
Dynamically find major tick positions. This is actually a subclass of ~matplotlib.ticker.MaxNLocator, with parameters nbins = ‘auto’ and steps = [1, 2, 2.5, 5, 10].
Inheritance
digraph inheritance9ba6a2e1ef { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "AutoLocator" [URL="#matplotlib.ticker.AutoLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Dynamically find major tick positions. This is actually a subclass"]; "MaxNLocator" -> "AutoLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MaxNLocator" [URL="#matplotlib.ticker.MaxNLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Find nice tick locations with no more than *nbins* + 1 being within the"]; "Locator" -> "MaxNLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }
- class matplotlib.ticker.MultipleLocator(base=1.0)
Set a tick on each integer multiple of the base within the view interval.
Inheritance
digraph inheritance1dd342ed0d { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MultipleLocator" [URL="#matplotlib.ticker.MultipleLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Set a tick on each integer multiple of the *base* within the view"]; "Locator" -> "MultipleLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- set_params(base)
Set parameters within this locator.
- tick_values(vmin, vmax)
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:>>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
- view_limits(dmin, dmax)
Set the view limits to the nearest multiples of base that contain the data.
- class matplotlib.ticker.MaxNLocator(nbins=None, **kwargs)
Find nice tick locations with no more than nbins + 1 being within the view limits. Locations beyond the limits are added to support autoscaling.
Inheritance
digraph inheritance5fcc58833d { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MaxNLocator" [URL="#matplotlib.ticker.MaxNLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Find nice tick locations with no more than *nbins* + 1 being within the"]; "Locator" -> "MaxNLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- set_params(**kwargs)
Set parameters for this locator.
- Parameters:
nbins (int or 'auto', optional) – see .MaxNLocator
steps (array-like, optional) – see .MaxNLocator
integer (bool, optional) – see .MaxNLocator
symmetric (bool, optional) – see .MaxNLocator
prune ({'lower', 'upper', 'both', None}, optional) – see .MaxNLocator
min_n_ticks (int, optional) – see .MaxNLocator
- tick_values(vmin, vmax)
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:>>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
- view_limits(dmin, dmax)
Select a scale for the range from vmin to vmax.
Subclasses should override this method to change locator behaviour.
- class matplotlib.ticker.AutoMinorLocator(n=None)
Dynamically find minor tick positions based on the positions of major ticks. The scale must be linear with major ticks evenly spaced.
Inheritance
digraph inheritancecdaab3daa5 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "AutoMinorLocator" [URL="#matplotlib.ticker.AutoMinorLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Dynamically find minor tick positions based on the positions of"]; "Locator" -> "AutoMinorLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- tick_values(vmin, vmax)
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:>>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
- class matplotlib.ticker.SymmetricalLogLocator(transform=None, subs=None, linthresh=None, base=None)
Determine the tick locations for symmetric log axes.
Inheritance
digraph inheritance922d09198c { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SymmetricalLogLocator" [URL="#matplotlib.ticker.SymmetricalLogLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations for symmetric log axes."]; "Locator" -> "SymmetricalLogLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- set_params(subs=None, numticks=None)
Set parameters within this locator.
- tick_values(vmin, vmax)
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:>>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
- view_limits(vmin, vmax)
Try to choose the view limits intelligently.
- class matplotlib.ticker.AsinhLocator(linear_width, numticks=11, symthresh=0.2, base=10, subs=None)
An axis tick locator specialized for the inverse-sinh scale
This is very unlikely to have any use beyond the ~.scale.AsinhScale class.
Note
This API is provisional and may be revised in the future based on early user feedback.
Inheritance
digraph inheritancee82a526323 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "AsinhLocator" [URL="#matplotlib.ticker.AsinhLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An axis tick locator specialized for the inverse-sinh scale"]; "Locator" -> "AsinhLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- set_params(numticks=None, symthresh=None, base=None, subs=None)
Set parameters within this locator.
- tick_values(vmin, vmax)
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:>>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
- class matplotlib.ticker.LogitLocator(minor=False, *, nbins='auto')
Determine the tick locations for logit axes
Inheritance
digraph inheritance24bd3d78b5 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Locator" [URL="#matplotlib.ticker.Locator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations;"]; "TickHelper" -> "Locator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LogitLocator" [URL="#matplotlib.ticker.LogitLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Determine the tick locations for logit axes"]; "MaxNLocator" -> "LogitLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MaxNLocator" [URL="#matplotlib.ticker.MaxNLocator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Find nice tick locations with no more than *nbins* + 1 being within the"]; "Locator" -> "MaxNLocator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TickHelper" [URL="#matplotlib.ticker.TickHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- nonsingular(vmin, vmax)
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.If
v0 == v1
(possibly up to some floating point slop), this method returns an expanded interval around this value.If
(v0, v1) == (-inf, +inf)
, this method returns appropriate default view limits.Otherwise,
(v0, v1)
is returned without modification.
- set_params(minor=None, **kwargs)
Set parameters within this locator.
- tick_values(vmin, vmax)
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:>>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]