astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v5.2.1 »
- Data Visualization (`astropy.visualization`) »
- quantity_support

# quantity_support

astropy.visualization.quantity_support(format='latex_inline')

  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:
    format `astropy.units.format.Base` instance or `python:str`

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