- class FuncScale(transform, invert=False, parent_scale=None, **kwargs)[source]¶
Axis scale composed of arbitrary forward and inverse transformations.
scale-spec) – The transform used to translate units from the parent axis to the secondary axis. Input can be as follows:
A single linear or involutory function that accepts a number and returns some transformation of that number. For example, to convert Kelvin to Celsius, use
ax.dualx(lambda x: x - 273.15). To convert kilometers to meters, use
ax.dualx(lambda x: x * 1e3).
A 2-tuple of arbitrary functions. This should only be used if your functions are non-linear and non-involutory. The second function must be the inverse of the first. For example, to apply the square, use
ax.dualx((lambda x: x ** 2, lambda x: x ** 0.5)).
A scale specification passed to the
Scaleconstructor function. The transform and default locators and formatters are borrowed from the resulting
ScaleBaseinstance. For example, to apply the inverse, use
ax.dualx('inverse'). To apply the base-10 exponential, use
bool, optional) – If
True, the forward and inverse functions are swapped. Used when drawing dual axes.
ScaleBase) – The axis scale of the “parent” axis. Its forward transform is applied to the
FuncTransform. Default is
major_locator, minor_locator (
locator-spec, optional) – The default major and minor locator. Passed to the
Locatorconstructor function. By default, these are the same as the default locators on the input transform. If the input transform was not an axis scale, these are borrowed from
major_formatter, minor_formatter (
formatter-spec, optional) – The default major and minor formatter. Passed to the
Formatterconstructor function. By default, these are the same as the default formatters on the input transform. If the input transform was not an axis scale, these are borrowed from