SimpleFormatter¶
- class SimpleFormatter(precision=None, zerotrim=None, tickrange=None, wraprange=None, prefix=None, suffix=None, negpos=None)[source]¶
Bases:
matplotlib.ticker.Formatter
Replicate various features from
AutoFormatter
. This is more suitable for arbitrary number formatting not necessarily associated with anyAxis
instance, e.g. labeling contours.- Parameters
precision (int, optional) – The maximum number of digits after the decimal point. Default is
6
whenzerotrim
isTrue
and2
otherwise.zerotrim (bool, optional) – Whether to trim trailing zeros. Default is
rc[‘formatter.zerotrim’]
=True
.tickrange ((float, float), optional) – Range within which major tick marks are labelled. Default is
(-np.inf, np.inf)
.wraprange ((float, float), optional) – Range outside of which tick values are wrapped. For example,
(0, 2)
will format a value of2.5
as0.5
, and(-180, 180)
will format a value of200
as-180 + 20 == -160
.prefix, suffix (str, optional) – Prefix and suffix for all tick strings.
negpos (str, optional) – Length-2 string indicating the suffix for “negative” and “positive” numbers, meant to replace the minus sign.
Methods Summary
__call__
(x[, pos])Convert number to a string.