class FracFormatter(symbol='', number=1)[source]

Bases: Formatter

Format numbers as integers or integer fractions. Optionally express the values relative to some constant like numpy.pi.

  • symbol (str, default: '') – The constant symbol, e.g. r'$\pi$'.

  • number (float, default: 1) – The constant value, e.g. numpy.pi.


The fractions shown by this formatter are resolved using the builtin fractions.Fraction class and fractions.Fraction.limit_denominator.

Methods Summary

__call__(x[, pos])

Convert number to a string.