XYAxes.dualx¶
-
XYAxes.dualx(transform, transform_kw=None, **kwargs)[source]¶ Makes a secondary x axis for denoting equivalent x 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.dualx(lambda x: x - 273.15). To convert kilometers to meters, useax.dualx(lambda x: x*1e3).inverse (function, optional) – Function used to transform units from the secondary axis back to the original axis. If
forwardwas a non-linear function, you must provide this, or the transformation will be incorrect!For example, to apply the square, use
ax.dualx(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.dualx('inverse'); To apply the base-10 exponential function, useax.dualx(('exp', 10, 1, 10))orax.dualx(plot.Scale('exp', 10)).scale_kw (dict-like, optional) – Ignored if
scaleisNone. 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.