Controlling Axes¶
Changing Axis Units¶
WCSAxes also allows users to change the units of the axes of an image. In the example in Slicing Multidimensional Data, the x axis represents velocity in m/s. We can change the unit to an equivalent one by:
import astropy.units as u
ax.coords[2].set_major_formatter('x.x') # Otherwise values round to the nearest whole number
ax.coords[2].set_format_unit(u.km / u.s)