units

units(value, units='in', axes=None, figure=None, width=True)[source]

Convert values and lists of values between arbitrary physical units. This is used internally all over ProPlot, permitting flexible units for various keyword arguments.

Parameters
  • value (float or str or list thereof) – A size specifier or list thereof. If numeric, nothing is done. If string, it is converted to units units. The string should look like '123.456unit', where the number is the magnitude and 'unit' is one of the following.

    Key

    Description

    'm'

    Meters

    'cm'

    Centimeters

    'mm'

    Millimeters

    'ft'

    Feet

    'in'

    Inches

    'pt'

    Points (1/72 inches)

    'pc'

    Pica (1/6 inches)

    'px'

    Pixels on screen, uses dpi of rc[‘figure.dpi’]

    'pp'

    Pixels once printed, uses dpi of rc[‘savefig.dpi’]

    'em'

    Em square for rc[‘font.size’]

    'en'

    En square for rc[‘font.size’]

    'Em'

    Em square for rc[‘axes.titlesize’]

    'En'

    En square for rc[‘axes.titlesize’]

    'ax'

    Axes relative units. Not always available.

    'fig'

    Figure relative units. Not always available.

    'ly'

    Light years ;)

  • units (str, optional) – The destination units. Default is inches, i.e. 'in'.

  • 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. If None we try to get the figure from axes.figure.

  • width (bool, optional) – Whether to use the width or height for the axes and figure relative coordinates.