| | |
- ColorConverter
- Colormap
-
- LinearSegmentedColormap
-
- ListedColormap
- Normalize
-
- LogNorm
- NoNorm
- NoNorm
class ColorConverter |
| | |
Methods defined here:
- to_rgb(self, arg)
- Returns an RGB tuple of three floats from 0-1.
arg can be an RGB or RGBA sequence or a string in any of several forms:
1) a letter from the set 'rgbcmykw'
2) a hex color string, like '#00FFFF'
3) a standard name, like 'aqua'
4) a float, like '0.4', indicating gray on a 0-1 scale
if arg is RGBA, the A will simply be discarded.
- to_rgba(self, arg, alpha=None)
- Returns an RGBA tuple of four floats from 0-1.
For acceptable values of arg, see to_rgb.
If arg is an RGBA sequence and alpha is not None,
alpha will replace the original A.
- to_rgba_list(self, c, alpha=None)
- Returns a list of rgba tuples.
Accepts a single mpl color spec or a sequence of specs.
If the sequence is a list, the list items are changed in place.
Data and other attributes defined here:
- cache = {}
- colors = {'b': (0.0, 0.0, 1.0), 'c': (0.0, 0.75, 0.75), 'g': (0.0, 0.5, 0.0), 'k': (0.0, 0.0, 0.0), 'm': (0.75, 0, 0.75), 'r': (1.0, 0.0, 0.0), 'w': (1.0, 1.0, 1.0), 'y': (0.75, 0.75, 0)}
|
class Colormap |
| |
Base class for all scalar to rgb mappings
Important methods:
set_bad()
set_under()
set_over() |
| |
Methods defined here:
- __call__(self, X, alpha=1.0)
- X is either a scalar or an array (of any dimension).
If scalar, a tuple of rgba values is returned, otherwise
an array with the new shape = oldshape+(4,). If the X-values
are integers, then they are used as indices into the array.
If they are floating point, then they must be in the
interval (0.0, 1.0).
Alpha must be a scalar.
- __init__(self, name, N=256)
- Public class attributes:
self.N: number of rgb quantization levels
self.name: name of colormap
- is_gray(self)
- set_bad(self, color='k', alpha=1.0)
- Set color to be used for masked values.
- set_over(self, color='k', alpha=1.0)
- Set color to be used for high out-of-range values.
Requires norm.clip = False
- set_under(self, color='k', alpha=1.0)
- Set color to be used for low out-of-range values.
Requires norm.clip = False
|
class LinearSegmentedColormap(Colormap) |
| |
Colormap objects based on lookup tables using linear segments.
The lookup transfer function is a simple linear function between
defined intensities. There is no limit to the number of segments
that may be defined. Though as the segment intervals start containing
fewer and fewer array locations, there will be inevitable quantization
errors |
| |
Methods defined here:
- __init__(self, name, segmentdata, N=256)
- Create color map from linear mapping segments
segmentdata argument is a dictionary with a red, green and blue
entries. Each entry should be a list of x, y0, y1 tuples.
See makeMappingArray for details
Methods inherited from Colormap:
- __call__(self, X, alpha=1.0)
- X is either a scalar or an array (of any dimension).
If scalar, a tuple of rgba values is returned, otherwise
an array with the new shape = oldshape+(4,). If the X-values
are integers, then they are used as indices into the array.
If they are floating point, then they must be in the
interval (0.0, 1.0).
Alpha must be a scalar.
- is_gray(self)
- set_bad(self, color='k', alpha=1.0)
- Set color to be used for masked values.
- set_over(self, color='k', alpha=1.0)
- Set color to be used for high out-of-range values.
Requires norm.clip = False
- set_under(self, color='k', alpha=1.0)
- Set color to be used for low out-of-range values.
Requires norm.clip = False
|
class ListedColormap(LinearSegmentedColormap) |
| |
Colormap object generated from a list of colors.
Color boundaries are evenly spaced. This is intended for simulating
indexed color selection, but may be useful for generating
special colormaps also. |
| |
- Method resolution order:
- ListedColormap
- LinearSegmentedColormap
- Colormap
Methods defined here:
- __init__(self, colors, name='from_list', N=None)
Methods inherited from Colormap:
- __call__(self, X, alpha=1.0)
- X is either a scalar or an array (of any dimension).
If scalar, a tuple of rgba values is returned, otherwise
an array with the new shape = oldshape+(4,). If the X-values
are integers, then they are used as indices into the array.
If they are floating point, then they must be in the
interval (0.0, 1.0).
Alpha must be a scalar.
- is_gray(self)
- set_bad(self, color='k', alpha=1.0)
- Set color to be used for masked values.
- set_over(self, color='k', alpha=1.0)
- Set color to be used for high out-of-range values.
Requires norm.clip = False
- set_under(self, color='k', alpha=1.0)
- Set color to be used for low out-of-range values.
Requires norm.clip = False
|
class LogNorm(Normalize) |
| |
Normalize a given value to the 0-1 range on a log scale |
| |
Methods defined here:
- __call__(self, value, clip=None)
- inverse(self, value)
Methods inherited from Normalize:
- __init__(self, vmin=None, vmax=None, clip=True)
- If vmin or vmax is not given, they are taken from the input's
minimum and maximum value respectively. If clip is True and
the given value falls outside the range, the returned value
will be 0 or 1, whichever is closer. Returns 0 if vmin==vmax.
Works with scalars or arrays, including masked arrays. If
clip is True, masked values are set to 1; otherwise they
remain masked.
- autoscale(self, A)
- Set vmin, vmax to min, max of A.
- autoscale_None(self, A)
- autoscale only None-valued vmin or vmax
- scaled(self)
- return true if vmin and vmax set
|
class NoNorm(Normalize) |
| |
Dummy replacement for Normalize, for the case where we
want to use indices directly in a ScalarMappable. |
| |
Methods defined here:
- __call__(self, value, clip=None)
- inverse(self, value)
Methods inherited from Normalize:
- __init__(self, vmin=None, vmax=None, clip=True)
- If vmin or vmax is not given, they are taken from the input's
minimum and maximum value respectively. If clip is True and
the given value falls outside the range, the returned value
will be 0 or 1, whichever is closer. Returns 0 if vmin==vmax.
Works with scalars or arrays, including masked arrays. If
clip is True, masked values are set to 1; otherwise they
remain masked.
- autoscale(self, A)
- Set vmin, vmax to min, max of A.
- autoscale_None(self, A)
- autoscale only None-valued vmin or vmax
- scaled(self)
- return true if vmin and vmax set
|
class Normalize |
| |
Normalize a given value to the 0-1 range |
| |
Methods defined here:
- __call__(self, value, clip=None)
- __init__(self, vmin=None, vmax=None, clip=True)
- If vmin or vmax is not given, they are taken from the input's
minimum and maximum value respectively. If clip is True and
the given value falls outside the range, the returned value
will be 0 or 1, whichever is closer. Returns 0 if vmin==vmax.
Works with scalars or arrays, including masked arrays. If
clip is True, masked values are set to 1; otherwise they
remain masked.
- autoscale(self, A)
- Set vmin, vmax to min, max of A.
- autoscale_None(self, A)
- autoscale only None-valued vmin or vmax
- inverse(self, value)
- scaled(self)
- return true if vmin and vmax set
|
no_norm = class NoNorm(Normalize) |
| |
Dummy replacement for Normalize, for the case where we
want to use indices directly in a ScalarMappable. |
| |
Methods defined here:
- __call__(self, value, clip=None)
- inverse(self, value)
Methods inherited from Normalize:
- __init__(self, vmin=None, vmax=None, clip=True)
- If vmin or vmax is not given, they are taken from the input's
minimum and maximum value respectively. If clip is True and
the given value falls outside the range, the returned value
will be 0 or 1, whichever is closer. Returns 0 if vmin==vmax.
Works with scalars or arrays, including masked arrays. If
clip is True, masked values are set to 1; otherwise they
remain masked.
- autoscale(self, A)
- Set vmin, vmax to min, max of A.
- autoscale_None(self, A)
- autoscale only None-valued vmin or vmax
- scaled(self)
- return true if vmin and vmax set
|
normalize = class Normalize |
| |
Normalize a given value to the 0-1 range |
| |
Methods defined here:
- __call__(self, value, clip=None)
- __init__(self, vmin=None, vmax=None, clip=True)
- If vmin or vmax is not given, they are taken from the input's
minimum and maximum value respectively. If clip is True and
the given value falls outside the range, the returned value
will be 0 or 1, whichever is closer. Returns 0 if vmin==vmax.
Works with scalars or arrays, including masked arrays. If
clip is True, masked values are set to 1; otherwise they
remain masked.
- autoscale(self, A)
- Set vmin, vmax to min, max of A.
- autoscale_None(self, A)
- autoscale only None-valued vmin or vmax
- inverse(self, value)
- scaled(self)
- return true if vmin and vmax set
| |