SigFigFormatter

class SigFigFormatter(sigfig=3, zerotrim=None)[source]

Bases: matplotlib.ticker.Formatter

Format numbers by retaining the specified number of significant digits.

Parameters
  • sigfig (float, optional) – The number of significant digits.

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

Methods Summary

__call__(x[, pos])

Convert number to a string.

Methods Documentation

__call__(x, pos=None)[source]

Convert number to a string.

Parameters
  • x (float) – The value.

  • pos (float, optional) – The position.