FuncScale¶

class FuncScale(arg, invert=False, parent_scale=None, major_locator=None, minor_locator=None, major_formatter=None, minor_formatter=None)[source]

Bases: `proplot.scale._Scale`, `matplotlib.scale.ScaleBase`

Axis scale composed of arbitrary forward and inverse transformations.

Parameters
• arg (`function`, `(function`, `function)`, or `ScaleBase`) – The transform used to translate units from the parent axis to the secondary axis. Input can be as follows:

• A single function that accepts a number and returns some transformation of that number. If you do not provide the inverse, the function must be linear or involutory. 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 such functions. 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))`. Again, if the first function is linear or involutory, you do not need to provide the second!

• A scale specification interpreted by the `Scale` constructor function. The forward transformation, inverse transformation, and default axis locators and formatters are borrowed from the resulting `ScaleBase` instance. For example, to apply the inverse, use `ax.dualx('inverse')`. To apply the base-10 exponential function, use `ax.dualx(('exp', 10))`.

• invert (`bool`, optional) – If `True`, the forward and inverse functions are swapped. Used when drawing dual axes.

• parent_scale (`ScaleBase`) – The axis scale of the “parent” axis. Its forward transform is applied to the `FuncTransform`. Used when drawing dual axes.

• major_locator, minor_locator (`Locator`, optional) – The default major and minor locator. By default these are borrowed from `transform`. If `transform` is not an axis scale, they are the same as `LinearScale`.

• major_formatter, minor_formatter (`Formatter`, optional) – The default major and minor formatter. By default these are borrowed from `transform`. If `transform` is not an axis scale, they are the same as `LinearScale`.

Attributes Summary

 `name` The registered scale name