units¶
- units(value, numeric=None, dest=None, *, fontsize=None, figure=None, axes=None, width=None)[source]¶
Convert values between arbitrary physical units. This is used internally all over proplot, permitting flexible units for various keyword arguments.
- Parameters
value (
floatorstror sequence) – A size specifier or sequence of size specifiers. If numeric, units are converted fromnumerictodest. If string, units are converted todestaccording to the string specifier. The string should look like'123.456unit', where the number is the magnitude and'unit'matches a key in the below table.Key
Description
'm'Meters
'dm'Decimeters
'cm'Centimeters
'mm'Millimeters
'yd'Yards
'ft'Feet
'in'Inches
'pc'Pica (1/6 inches)
'pt'Points (1/72 inches)
'px'Pixels on screen, using dpi of
rc['figure.dpi']'pp'Pixels once printed, using dpi of
rc['savefig.dpi']'em''en''Em''En''ax'Axes-relative units (not always available)
'fig'Figure-relative units (not always available)
'ly'Light years ;)
numeric (
str, optional) – The units associated with numeric input. Default is inches.dest (
str, optional) – The destination units. Default is the same asnumeric.fontsize (
strorfloat, optional) – The font size in points used for scaling. Default isrc['font.size']foremandenunits andrc['axes.titlesize']forEmandEnunits.axes (
Axes, optional) – The axes to use for scaling units that look like'0.1ax'.figure (
Figure, optional) – The figure to use for scaling units that look like'0.1fig'. IfNonewe try to get the figure fromaxes.figure.width (
bool, optional) – Whether to use the width or height for the axes and figure relative coordinates.