add_scalebar

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

Add a scale bar

Parameters:
axWCSAxes

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

lengthfloat or Quantity

The lenght of the scalebar in degrees or an angular quantity

labelstr, optional

Label to place below the scale bar

cornerstr, optional

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

framebool, optional

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

borderpadfloat, optional

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

padfloat, 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)