astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v5.2.1 »
- Data Visualization (`astropy.visualization`) »
- Making plots with world coordinates (WCSAxes) »
- add_scalebar

# add_scalebar

astropy.visualization.wcsaxes.add_scalebar(ax, length, label=None, corner='bottom right', frame=False, borderpad=0.4, pad=0.5, **kwargs)

  Add a scale bar

  Parameters:
    ax `WCSAxes`

      WCSAxes instance in which the scale bar is displayed. The WCS must be celestial.

    length `python:float` or `Quantity`

      The lenght of the scalebar in degrees or an angular quantity

    label `python:str`, optional

      Label to place below the scale bar

    corner `python:str`, optional

      Where to place the scale bar. Acceptable values are:, `'left'`, `'right'`, `'top'`, `'bottom'`, `'top left'`, `'top right'`, `'bottom left'` and `'bottom right'` (default)

    frame bool, optional

      Whether to display a frame behind the scale bar (default is `False`)

    borderpad `python:float`, optional

      Border padding, in fraction of the font size. Default is 0.4.

    pad `python:float`, optional

      Padding around the scale bar, in fraction of the font size. Default is 0.5.

    kwargs

      Additional arguments are passed to `mpl_toolkits.axes_grid1.anchored_artists.AnchoredSizeBar`.

  Notes

  This function may be inaccurate when:

  - The pixel scales at the reference pixel are different from the pixel scales within the image extent (e.g., when the reference pixel is well outside of the image extent and the projection is non-linear)

  - The pixel scales in the two directions are very different from each other (e.g., rectangular pixels)