matplotlib.axis.Axis.set_major_formatter#
- Axis.set_major_formatter(formatter)[source]#
Set the formatter of the major ticker.
In addition to a
Formatter
instance, this also accepts astr
or function.For a
str
aStrMethodFormatter
is used. The field used for the value must be labeled'x'
and the field used for the position must be labeled'pos'
. See theStrMethodFormatter
documentation for more information.For a function, a
FuncFormatter
is used. The function must take two inputs (a tick valuex
and a positionpos
), and return a string containing the corresponding tick label. See theFuncFormatter
documentation for more information.- Parameters:
- formatter
Formatter
,str
, or function
- formatter
Examples using matplotlib.axis.Axis.set_major_formatter
#
Creating a timeline with lines, dates, and text
Labeling ticks using engineering notation
SkewT-logP diagram: using transforms and custom projections
Centering labels between ticks
Formatting date ticks using ConciseDateFormatter
Placing date ticks using recurrence rules
Custom tick formatter for time series
Setting tick labels from a list of values
Choosing Colormaps in Matplotlib