cbrt_scale#

Custom matplotlib scale for cube-root axis scaling.

class matviz.cbrt_scale.CubeRootScale(axis, **kwargs)[source]#

Bases: ScaleBase

ScaleBase class for generating square root scale.

Use: from matviz import cbrt_scale ax.set_yscale(‘cuberoot’)

class CubeRootTransform(shorthand_name=None)[source]#

Bases: Transform

has_inverse = True#

True if this transform has a corresponding inverse transform.

input_dims = 1#

The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.

inverted()[source]#

Return the corresponding inverse transformation.

It holds x == self.inverted().transform(self.transform(x)).

The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.

is_separable = True#

True if this transform is separable in the x- and y- dimensions.

output_dims = 1#

The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.

transform_non_affine(a)[source]#

Apply only the non-affine part of this transformation.

transform(values) is always equivalent to transform_affine(transform_non_affine(values)).

In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op.

Parameters:
valuesarray

The input values as an array of length input_dims or shape (N, input_dims).

Returns:
array

The output values as an array of length output_dims or shape (N, output_dims), depending on the input.

class InvertedCubeRootTransform(shorthand_name=None)[source]#

Bases: Transform

has_inverse = True#

True if this transform has a corresponding inverse transform.

input_dims = 1#

The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.

inverted()[source]#

Return the corresponding inverse transformation.

It holds x == self.inverted().transform(self.transform(x)).

The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.

is_separable = True#

True if this transform is separable in the x- and y- dimensions.

output_dims = 1#

The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.

transform(a)[source]#

Apply this transformation on the given array of values.

Parameters:
valuesarray-like

The input values as an array of length input_dims or shape (N, input_dims).

Returns:
array

The output values as an array of length output_dims or shape (N, output_dims), depending on the input.

get_transform()[source]#

Return the .Transform object associated with this scale.

limit_range_for_scale(vmin, vmax, minpos)[source]#

Return the range vmin, vmax, restricted to the domain supported by this scale (if any).

minpos should be the minimum positive value in the data. This is used by log scales to determine a minimum value.

name = 'cuberoot'#
set_default_locators_and_formatters(axis)[source]#

Set the locators and formatters of axis to instances suitable for this scale.