XYAxes.dualy¶
-
XYAxes.
dualy
(transform, transform_kw=None, **kwargs)[source]¶ Makes a secondary y axis for denoting equivalent y coordinates in alternate units.
- Parameters
forward (function, optional) – Function used to transform units from the original axis to the secondary axis. Should take 1 value and perform a forward linear transformation. For example, to convert Kelvin to Celsius, use
ax.dualy(lambda x: x - 273.15)
. To convert kilometers to meters, useax.dualy(lambda x: x*1e3)
.inverse (function, optional) – Function used to transform units from the secondary axis back to the original axis. If
forward
was a non-linear function, you must provide this, or the transformation will be incorrect!For example, to apply the square, use
ax.dualy(lambda x: x**2, lambda x: x**0.5)
.scale (scale-spec, optional) – The axis scale from which forward and inverse transformations are inferred. Passed to
Scale
.For example, to apply the inverse, use
ax.dualy('inverse')
; To apply the base-10 exponential function, useax.dualy(('exp', 10, 1, 10))
orax.dualy(plot.Scale('exp', 10))
.scale_kw (dict-like, optional) – Ignored if
scale
isNone
. Passed toScale
.label, locator, formatter, ticks, ticklabels, minorlocator, minorticks, tickminor, ticklen, tickrange, tickdir, ticklabeldir, tickrotation, bounds, margin, color, grid, gridminor, gridcolor (optional) – Prepended with
'y'
and passed toAxes.format
.