FracFormatter

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

Bases: matplotlib.ticker.Formatter

Format numbers as fractions or multiples of some arbitrary value. This is powered by the builtin Fraction class and the limit_denominator method.

Parameters
  • symbol (str) – The symbol, e.g. r'$\pi$'. Default is ''.

  • number (float) – The value, e.g. numpy.pi. Default is 1.

Methods Summary

__call__(x[, pos])

Convert number to a string.