You are reading an old version of the documentation (v2.2.2). For the latest version see https://matplotlib.org/stable/api/scale_api.html
Version 2.2.2
matplotlib
Fork me on GitHub

Table Of Contents

Related Topics

scale

matplotlib.scale

class matplotlib.scale.InvertedLog10Transform(shorthand_name=None)[source]

Bases: matplotlib.scale.InvertedLogTransformBase

Creates a new TransformNode.

Parameters:
shorthand_name : str

A string representing the “name” of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.

base = 10.0
inverted()[source]

Return the corresponding inverse transformation.

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.

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

class matplotlib.scale.InvertedLog2Transform(shorthand_name=None)[source]

Bases: matplotlib.scale.InvertedLogTransformBase

Creates a new TransformNode.

Parameters:
shorthand_name : str

A string representing the “name” of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.

base = 2.0
inverted()[source]

Return the corresponding inverse transformation.

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.

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

class matplotlib.scale.InvertedLogTransform(base)[source]

Bases: matplotlib.scale.InvertedLogTransformBase

inverted()[source]

Return the corresponding inverse transformation.

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.

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

class matplotlib.scale.InvertedLogTransformBase(shorthand_name=None)[source]

Bases: matplotlib.transforms.Transform

Creates a new TransformNode.

Parameters:
shorthand_name : str

A string representing the “name” of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.

has_inverse = True
input_dims = 1
is_separable = True
output_dims = 1
transform_non_affine(a)[source]

Performs only the non-affine part of the 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.

Accepts a numpy array of shape (N x input_dims) and returns a numpy array of shape (N x output_dims).

Alternatively, accepts a numpy array of length input_dims and returns a numpy array of length output_dims.

class matplotlib.scale.InvertedNaturalLogTransform(shorthand_name=None)[source]

Bases: matplotlib.scale.InvertedLogTransformBase

Creates a new TransformNode.

Parameters:
shorthand_name : str

A string representing the “name” of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.

base = 2.718281828459045
inverted()[source]

Return the corresponding inverse transformation.

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.

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

class matplotlib.scale.InvertedSymmetricalLogTransform(base, linthresh, linscale)[source]

Bases: matplotlib.transforms.Transform

has_inverse = True
input_dims = 1
inverted()[source]

Return the corresponding inverse transformation.

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.

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

is_separable = True
output_dims = 1
transform_non_affine(a)[source]

Performs only the non-affine part of the 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.

Accepts a numpy array of shape (N x input_dims) and returns a numpy array of shape (N x output_dims).

Alternatively, accepts a numpy array of length input_dims and returns a numpy array of length output_dims.

class matplotlib.scale.LinearScale(axis, **kwargs)[source]

Bases: matplotlib.scale.ScaleBase

The default linear scale.

get_transform()[source]

The transform for linear scaling is just the IdentityTransform.

name = 'linear'
set_default_locators_and_formatters(axis)[source]

Set the locators and formatters to reasonable defaults for linear scaling.

class matplotlib.scale.Log10Transform(nonpos='clip')[source]

Bases: matplotlib.scale.LogTransformBase

base = 10.0
inverted()[source]

Return the corresponding inverse transformation.

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.

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

class matplotlib.scale.Log2Transform(nonpos='clip')[source]

Bases: matplotlib.scale.LogTransformBase

base = 2.0
inverted()[source]

Return the corresponding inverse transformation.

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.

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

class matplotlib.scale.LogScale(axis, **kwargs)[source]

Bases: matplotlib.scale.ScaleBase

A standard logarithmic scale. Care is taken so non-positive values are not plotted.

For computational efficiency (to push as much as possible to Numpy C code in the common cases), this scale provides different transforms depending on the base of the logarithm:

basex/basey:
The base of the logarithm
nonposx/nonposy: [‘mask’ | ‘clip’ ]
non-positive values in x or y can be masked as invalid, or clipped to a very small positive number
subsx/subsy:

Where to place the subticks between each major tick. Should be a sequence of integers. For example, in a log10 scale: [2, 3, 4, 5, 6, 7, 8, 9]

will place 8 logarithmically spaced minor ticks between each major tick.

class InvertedLog10Transform(shorthand_name=None)

Bases: matplotlib.scale.InvertedLogTransformBase

Creates a new TransformNode.

Parameters:
shorthand_name : str

A string representing the “name” of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.

base = 10.0
inverted()

Return the corresponding inverse transformation.

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.

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

class InvertedLog2Transform(shorthand_name=None)

Bases: matplotlib.scale.InvertedLogTransformBase

Creates a new TransformNode.

Parameters:
shorthand_name : str

A string representing the “name” of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.

base = 2.0
inverted()

Return the corresponding inverse transformation.

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.

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

class InvertedLogTransform(base)

Bases: matplotlib.scale.InvertedLogTransformBase

inverted()

Return the corresponding inverse transformation.

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.

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

class InvertedNaturalLogTransform(shorthand_name=None)

Bases: matplotlib.scale.InvertedLogTransformBase

Creates a new TransformNode.

Parameters:
shorthand_name : str

A string representing the “name” of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.

base = 2.718281828459045
inverted()

Return the corresponding inverse transformation.

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.

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

class Log10Transform(nonpos='clip')

Bases: matplotlib.scale.LogTransformBase

base = 10.0
inverted()

Return the corresponding inverse transformation.

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.

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

class Log2Transform(nonpos='clip')

Bases: matplotlib.scale.LogTransformBase

base = 2.0
inverted()

Return the corresponding inverse transformation.

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.

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

class LogTransform(base, nonpos='clip')

Bases: matplotlib.scale.LogTransformBase

inverted()

Return the corresponding inverse transformation.

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.

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

class LogTransformBase(nonpos='clip')

Bases: matplotlib.transforms.Transform

has_inverse = True
input_dims = 1
is_separable = True
output_dims = 1
transform_non_affine(a)

Performs only the non-affine part of the 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.

Accepts a numpy array of shape (N x input_dims) and returns a numpy array of shape (N x output_dims).

Alternatively, accepts a numpy array of length input_dims and returns a numpy array of length output_dims.

class NaturalLogTransform(nonpos='clip')

Bases: matplotlib.scale.LogTransformBase

base = 2.718281828459045
inverted()

Return the corresponding inverse transformation.

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.

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

get_transform()[source]

Return a Transform instance appropriate for the given logarithm base.

limit_range_for_scale(vmin, vmax, minpos)[source]

Limit the domain to positive values.

name = 'log'
set_default_locators_and_formatters(axis)[source]

Set the locators and formatters to specialized versions for log scaling.

class matplotlib.scale.LogTransform(base, nonpos='clip')[source]

Bases: matplotlib.scale.LogTransformBase

inverted()[source]

Return the corresponding inverse transformation.

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.

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

class matplotlib.scale.LogTransformBase(nonpos='clip')[source]

Bases: matplotlib.transforms.Transform

has_inverse = True
input_dims = 1
is_separable = True
output_dims = 1
transform_non_affine(a)[source]

Performs only the non-affine part of the 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.

Accepts a numpy array of shape (N x input_dims) and returns a numpy array of shape (N x output_dims).

Alternatively, accepts a numpy array of length input_dims and returns a numpy array of length output_dims.

class matplotlib.scale.LogisticTransform(nonpos='mask')[source]

Bases: matplotlib.transforms.Transform

has_inverse = True
input_dims = 1
inverted()[source]

Return the corresponding inverse transformation.

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.

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

is_separable = True
output_dims = 1
transform_non_affine(a)[source]

logistic transform (base 10)

class matplotlib.scale.LogitScale(axis, nonpos='mask')[source]

Bases: matplotlib.scale.ScaleBase

Logit scale for data between zero and one, both excluded.

This scale is similar to a log scale close to zero and to one, and almost linear around 0.5. It maps the interval ]0, 1[ onto ]-infty, +infty[.

nonpos: [‘mask’ | ‘clip’ ]
values beyond ]0, 1[ can be masked as invalid, or clipped to a number very close to 0 or 1
get_transform()[source]

Return a LogitTransform instance.

limit_range_for_scale(vmin, vmax, minpos)[source]

Limit the domain to values between 0 and 1 (excluded).

name = 'logit'
set_default_locators_and_formatters(axis)[source]

Set the Locator and Formatter objects on the given axis to match this scale.

class matplotlib.scale.LogitTransform(nonpos='mask')[source]

Bases: matplotlib.transforms.Transform

has_inverse = True
input_dims = 1
inverted()[source]

Return the corresponding inverse transformation.

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.

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

is_separable = True
output_dims = 1
transform_non_affine(a)[source]

logit transform (base 10), masked or clipped

class matplotlib.scale.NaturalLogTransform(nonpos='clip')[source]

Bases: matplotlib.scale.LogTransformBase

base = 2.718281828459045
inverted()[source]

Return the corresponding inverse transformation.

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.

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

class matplotlib.scale.ScaleBase[source]

Bases: object

The base class for all scales.

Scales are separable transformations, working on a single dimension.

Any subclasses will want to override:

And optionally:
get_transform()[source]

Return the Transform object associated with this scale.

limit_range_for_scale(vmin, vmax, minpos)[source]

Returns the range vmin, vmax, possibly limited to the domain supported by this scale.

minpos should be the minimum positive value in the data.
This is used by log scales to determine a minimum value.
set_default_locators_and_formatters(axis)[source]

Set the Locator and Formatter objects on the given axis to match this scale.

class matplotlib.scale.SymmetricalLogScale(axis, **kwargs)[source]

Bases: matplotlib.scale.ScaleBase

The symmetrical logarithmic scale is logarithmic in both the positive and negative directions from the origin.

Since the values close to zero tend toward infinity, there is a need to have a range around zero that is linear. The parameter linthresh allows the user to specify the size of this range (-linthresh, linthresh).

basex/basey:
The base of the logarithm
linthreshx/linthreshy:
A single float which defines the range (-x, x), within which the plot is linear. This avoids having the plot go to infinity around zero.
subsx/subsy:

Where to place the subticks between each major tick. Should be a sequence of integers. For example, in a log10 scale: [2, 3, 4, 5, 6, 7, 8, 9]

will place 8 logarithmically spaced minor ticks between each major tick.

linscalex/linscaley:
This allows the linear range (-linthresh to linthresh) to be stretched relative to the logarithmic range. Its value is the number of decades to use for each half of the linear range. For example, when linscale == 1.0 (the default), the space used for the positive and negative halves of the linear range will be equal to one decade in the logarithmic range.
class InvertedSymmetricalLogTransform(base, linthresh, linscale)

Bases: matplotlib.transforms.Transform

has_inverse = True
input_dims = 1
inverted()

Return the corresponding inverse transformation.

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.

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

is_separable = True
output_dims = 1
transform_non_affine(a)

Performs only the non-affine part of the 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.

Accepts a numpy array of shape (N x input_dims) and returns a numpy array of shape (N x output_dims).

Alternatively, accepts a numpy array of length input_dims and returns a numpy array of length output_dims.

class SymmetricalLogTransform(base, linthresh, linscale)

Bases: matplotlib.transforms.Transform

has_inverse = True
input_dims = 1
inverted()

Return the corresponding inverse transformation.

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.

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

is_separable = True
output_dims = 1
transform_non_affine(a)

Performs only the non-affine part of the 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.

Accepts a numpy array of shape (N x input_dims) and returns a numpy array of shape (N x output_dims).

Alternatively, accepts a numpy array of length input_dims and returns a numpy array of length output_dims.

get_transform()[source]

Return a SymmetricalLogTransform instance.

name = 'symlog'
set_default_locators_and_formatters(axis)[source]

Set the locators and formatters to specialized versions for symmetrical log scaling.

class matplotlib.scale.SymmetricalLogTransform(base, linthresh, linscale)[source]

Bases: matplotlib.transforms.Transform

has_inverse = True
input_dims = 1
inverted()[source]

Return the corresponding inverse transformation.

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.

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

is_separable = True
output_dims = 1
transform_non_affine(a)[source]

Performs only the non-affine part of the 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.

Accepts a numpy array of shape (N x input_dims) and returns a numpy array of shape (N x output_dims).

Alternatively, accepts a numpy array of length input_dims and returns a numpy array of length output_dims.

matplotlib.scale.get_scale_docs()[source]

Helper function for generating docstrings related to scales.

matplotlib.scale.get_scale_names()[source]
matplotlib.scale.register_scale(scale_class)[source]

Register a new kind of scale.

scale_class must be a subclass of ScaleBase.

matplotlib.scale.scale_factory(scale, axis, **kwargs)[source]

Return a scale class by name.

ACCEPTS: [ linear | log | logit | symlog ]