quantity_support#

astropy.visualization.quantity_support(format='latex_inline')[source]#

Enable support for plotting astropy.units.Quantity instances in matplotlib.

May be (optionally) used with a with statement.

>>> import matplotlib.pyplot as plt
>>> from astropy import units as u
>>> from astropy import visualization
>>> with visualization.quantity_support():
...     plt.figure()
...     plt.plot([1, 2, 3] * u.m)
[...]
...     plt.plot([101, 125, 150] * u.cm)
[...]
...     plt.draw()
Parameters:
formatastropy.units.format.Base instance or str

The name of a format or a formatter object. If not provided, defaults to latex_inline.