AutoFormatter¶
- class AutoFormatter(zerotrim=None, tickrange=None, wraprange=None, prefix=None, suffix=None, negpos=None, **kwargs)[source]¶
Bases:
matplotlib.ticker.ScalarFormatterThe new default tick label formatter.
- Parameters
zerotrim (
bool, optional) – Whether to trim trailing decimal zeros. Default isrc['formatter.zerotrim']=True.tickrange (
2-tupleoffloat, optional) – Range within which major tick marks are labelled. Default is(-np.inf, np.inf).wraprange (
2-tupleoffloat, optional) – Range outside of which tick values are wrapped. For example,(-180, 180)will format a value of200as-160.prefix, suffix (
str, optional) – Prefix and suffix for all tick strings. The suffix is added before the optionalnegpossuffix.negpos (
str, optional) – Length-2 string indicating the suffix for “negative” and “positive” numbers, meant to replace the minus sign.
- Other Parameters
**kwargs – Passed to
matplotlib.ticker.ScalarFormatter.
Note
matplotlib.ticker.ScalarFormatterdetermines the number of significant digits based on the axis limits, and therefore may truncate digits while formatting ticks on highly non-linear axis scales likeLogScale.AutoFormattercorrects this behavior, making it suitable for arbitrary axis scales. We therefore useAutoFormatterwith every axis scale by default.Methods Summary
__call__(x[, pos])Convert number to a string.
Get the offset but always use math text.