class Units[source]#

Bases: object

This object controls the units of a plotted figure, and performs multiple tasks when making the plot:

1: Species the units of the plot (e.g. meters, kilometers) and contains a conversion factor which converts the plotted data from its current units (e.g. meters) to the units plotted (e.g. kilometeters). Pixel units can be used if use_scaled=False.

2: Uses the conversion above to manually override the yticks and xticks of the figure, so it appears in the converted units.

3: Sets the ylabel and xlabel to include a string containing the units.

  • use_scaled (Optional[bool]) – If True, plot the 2D data with y and x ticks corresponding to its scaled coordinates (its pixel_scales attribute is used as the ticks_convert_factor). If False plot them in pixel units.

  • ticks_convert_factor (Optional[float]) – If plotting the labels in scaled units, this factor multiplies the values that are used for the labels. This allows for additional unit conversions of the figure labels.