class AutoFormatter(*args, zerotrim=None, precision=None, tickrange=None, prefix=None, suffix=None, **kwargs)[source]

Bases: matplotlib.ticker.ScalarFormatter

The new default formatter, a simple wrapper around ScalarFormatter. Differs from ScalarFormatter in the following ways:

  1. Trims trailing zeros if any exist.

  2. Allows user to specify range within which major tick marks are labelled.

  3. Allows user to add arbitrary prefix or suffix to every tick label string.

  • zerotrim (bool, optional) – Whether to trim trailing zeros. Default is rc[‘axes.formatter.zerotrim’] = True.

  • precision (float, optional) – The maximum number of digits after the decimal point.

  • tickrange ((float, float), optional) – Range within which major tick marks are labelled.

  • prefix, suffix (str, optional) – Optional prefix and suffix for all strings.

  • *args, **kwargs – Passed to matplotlib.ticker.ScalarFormatter.

Methods Summary

__call__(x[, pos])

Convert number to a string.