PlasmaCalcs.plotting.plot_tools.colors.BaseColormap

class PlasmaCalcs.plotting.plot_tools.colors.BaseColormap(*args_super, **kw_super)

Bases: Colormap

matplotlib.colors.Colormap class with more methods, and some properties.
__init__(*args_super, **kw_super)
Parameters
———-
namestr
The name of the colormap.
Nint
The number of RGB quantization levels.

Methods

__init__(*args_super, **kw_super)

copy()

get_bad()

get_extremes()

get_over()

get_under()

is_gray()

resampled(lutsize)

reversed([name])

set_bad([color, alpha])

set_extremes(*[, under, over, bad])

set_over([color, alpha])

set_under([color, alpha])

with_bad(bad)

with_extremes(*[, under, over, bad])

with_over(over)

with_under(under)

Attributes

bad

colorbar_extend

colorbar_extend_settings

extremes

over

under

property bad
the color for masked values. Use self.bad=None to restore default.
property colorbar_extend
defaults instructions for whether to extend colorbars using this colormap.
One of the following values:
‘neither’ –> do not extend colorbar.
‘both’ –> extend colorbar in both directions.
‘min’ –> extend colorbar in the direction of the minimum value.
‘max’ –> extend colorbar in the direction of the maximum value.
When setting self.colorbar_extend=value, value can be:
str –> use value (must be ‘neither’, ‘both’, ‘min’, or ‘max’).
True –> use ‘both’
False –> use ‘neither’
property colorbar_extend_settings
the current dict(under=bool, over=bool) corresponding to colorbar_extend.
copy()
Return a copy of the colormap.
property extremes
(under, over, bad), as a ColormapExtremes namedtuple.
setting self.extremes = value is possible, but to avoid ambiguity:
value must have keys “under”, “over”, and/or “bad”,
or attributes “under”, “over”, and/or “bad”.
e.g. self.extremes = dict(under=’blue’)
(equivalent to self.under=’blue’)
Use None to reset to default, e.g. self.extremes = None,
(equivalent to self.under=None, self.over=None, self.bad=None)
or for any keys, e.g. self.extremes = dict(under=’blue’, over=None)
(equivalent to self.under=’blue’, self.over=None, but not adjusting self.bad)
get_bad()
Get the color for masked values.
get_extremes()
return (under, over, bad) colors, as a ColormapExtremes namedtuple.
get_over()
Get the color for high out-of-range values.
get_under()
Get the color for low out-of-range values.
is_gray()
Return whether the colormap is grayscale.
property over
the color for high out-of-range values.
when setting self.over = value, value can be:
str –> use this color.
None or bool –> use the default color (top of the colormap).
if not None, also sets self.colorbar_extend_settings[‘over’],
to True if (str or True), else False.
resampled(lutsize)
Return a new colormap with lutsize entries.
reversed(name=None)
Return a reversed instance of the Colormap.
.. note:: This function is not implemented for the base class.
Parameters
———-
namestr, optional
The name for the reversed colormap. If None, the
name is set to `self.name + "_r"`.
See Also
——–
LinearSegmentedColormap.reversed
ListedColormap.reversed
set_bad(color=None, alpha=None, **kw_super)
set the color for masked values. See help(type(self).bad) for details.
set_extremes(*, under=NO_VALUE, over=NO_VALUE, bad=NO_VALUE)
set under, over, bad colors, based on keywords.
see help(type(self).extremes) for details.
set_over(color=None, alpha=None, **kw_super)
set the color for high out-of-range values. See help(type(self).over) for details.
set_under(color=None, alpha=None, **kw_super)
set the color for low out-of-range values. See help(type(self).under) for details.
property under
the color for low out-of-range values.
when setting self.under = value, value can be:
str –> use this color.
None –> use the default color (bottom of the colormap).
if not None, also sets self.colorbar_extend_settings[‘under’],
to True if (str or True), else False.
with_bad(bad)
return a copy of self, with new color for bad.
with_extremes(*, under=NO_VALUE, over=NO_VALUE, bad=NO_VALUE)
return a copy of self, with new colors for under, over, and/or bad.
see help(type(self).extremes) for details.
with_over(over)
return a copy of self, with new color for over.
with_under(under)
return a copy of self, with new color for under.