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:
- ax
WCSAxes
WCSAxes instance in which the scale bar is displayed. The WCS must be celestial.
- length
float
orQuantity
The length of the scalebar in degrees or an angular quantity
- label
str
, optional Label to place below the scale bar
- corner
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)- framebool, optional
Whether to display a frame behind the scale bar (default is
False
)- borderpad
float
, optional Border padding, in fraction of the font size. Default is 0.4.
- pad
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
.
- ax
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)