Bases: LinearSegmentedColormap
, _Colormap
Replacement for LinearSegmentedColormap
.
segmentdata (dict-like) – Dictionary containing the keys 'red'
, 'green'
, 'blue'
, and (optionally) 'alpha'
. The shorthands 'r'
, 'g'
, 'b'
, and 'a'
are also acceptable. The key values can be callable functions that return channel values given a colormap index, or 3-column arrays indicating the coordinates and channel transitions. See matplotlib.colors.LinearSegmentedColormap
for a detailed explanation.
name (str
, default: '_no_name'
) – The colormap name. This can also be passed as the first positional string argument.
N (int
, default: rc['image.lut']
= 256
) – Number of points in the colormap lookup table.
gamma (float
, optional) – Gamma scaling used for the x coordinates.
alpha (float
, optional) – The opacity for the entire colormap. This overrides the input opacities.
cyclic (bool
, optional) – Whether the colormap is cyclic. If True
, this changes how the leftmost and rightmost color levels are selected, and extend
can only be 'neither'
(a warning will be issued otherwise).
**kwargs – Passed to matplotlib.colors.LinearSegmentedColormap
.
Methods Summary
append
(*args[, ratios, name, N])
Return the concatenation of this colormap with the input colormaps.
concatenate
(*[, new_obj, message])
copy
([name, segmentdata, N, alpha, gamma, ...])
Return a new colormap with relevant properties copied from this one if they were not provided as keyword arguments.
cut
([cut, name, left, right])
Return a version of the colormap with the center "cut out".
from_file
(path, *[, warn_on_failure])
Load colormap from a file.
from_list
(*args, **kwargs)
Make a ContinuousColormap
from a sequence of colors.
punched
(*[, new_obj, message])
reversed
([name])
Return a reversed copy of the colormap.
save
([path, alpha])
Save the colormap data to a file.
set_alpha
(alpha[, coords, ratios])
Set the opacity for the entire colormap or set up an opacity gradation.
set_cyclic
(b)
Set whether this colormap is "cyclic".
shifted
([shift, name])
Return a cyclicaly shifted version of the colormap.
to_discrete
([samples, name])
Convert the ContinuousColormap
to a DiscreteColormap
by drawing samples from the colormap.
to_listed
(*[, new_obj, message])
truncate
([left, right, name])
Return a truncated version of the colormap.
truncated
(*[, new_obj, message])
updated
(*[, new_obj, message])
Methods Documentation
Return the concatenation of this colormap with the input colormaps.
*args – Instances of ContinuousColormap
.
ratios (sequence of float
, optional) – Relative extent of each component colormap in the merged colormap. Length must equal len(args) + 1
. For example, cmap1.append(cmap2, ratios=(2, 1))
generates a colormap with the left two-thrids containing colors from cmap1
and the right one-third containing colors from cmap2
.
name (str
, optional) – The colormap name. Default is to merge each name with underscores and prepend a leading underscore, for example _name1_name2
.
N (int
, optional) – The number of points in the colormap lookup table. Default is to sum the length of each lookup table.
**kwargs – Passed to ContinuousColormap.copy
or PerceptualColormap.copy
.
ContinuousColormap
– The colormap.
Return a new colormap with relevant properties copied from this one if they were not provided as keyword arguments.
name (str
, default: '_name_copy'
) – The new colormap name.
segmentdata, N, alpha, gamma, cyclic (optional) – See ContinuousColormap
. If not provided, these are copied from the current colormap.
Return a version of the colormap with the center “cut out”. This is great for making the transition from “negative” to “positive” in a diverging colormap more distinct.
cut (float
, optional) – The proportion to cut from the center of the colormap. For example, cut=0.1
cuts the central 10%, or cut=-0.1
fills the ctranl 10% of the colormap with the current central color (usually white).
name (str
, default: '_name_copy'
) – The new colormap name.
left, right (float
, default: 0
, 1
) – The colormap indices for the “leftmost” and “rightmost” colors. See truncate
for details.
right (float
, optional) – The colormap index for the new “rightmost” color. Must fall between
**kwargs – Passed to ContinuousColormap.copy
or PerceptualColormap.copy
.
ContinuousColormap
– The colormap.
Load colormap from a file.
path (path-like) – The file path. Valid file extensions are shown in the below table.
Extension
Description
.json
JSON database of the channel segment data.
.hex
Comma-delimited list of HEX strings.
.rgb
, .txt
3-4 column table of channel values.
warn_on_failure (bool
, optional) – If True
, issue a warning when loading fails instead of raising an error.
Make a ContinuousColormap
from a sequence of colors.
colors (sequence of color-spec
or tuple
) – If a sequence of RGB[A] tuples or color strings, the colormap transitions evenly from colors[0]
at the left-hand side to colors[-1]
at the right-hand side.
If a sequence of (float, color-spec) tuples, the float values are the coordinate of each transition and must range from 0 to 1. This can be used to divide the colormap range unevenly.
name (str
, default: '_no_name'
) – The colormap name. This can also be passed as the first positional string argument.
ratios (sequence of float
, optional) – Relative extents of each color transition. Must have length len(colors) - 1
. Larger numbers indicate a slower transition, smaller numbers indicate a faster transition. For example, ('red', 'blue', 'green')
with ratios=(2, 1)
creates a colormap with the transition from red to blue taking twice as long as the transition from blue to green.
**kwargs – Passed to ContinuousColormap
.
ContinuousColormap
– The colormap.
Return a reversed copy of the colormap.
name (str
, default: '_name_r'
) – The new colormap name.
**kwargs – Passed to ContinuousColormap.copy
or PerceptualColormap.copy
.
Save the colormap data to a file.
path (path-like, optional) – The output filename. If not provided, the colormap is saved in the cmaps
subfolder in user_folder()
under the filename name.json
(where name
is the colormap name). Valid extensions are shown in the below table.
Extension
Description
.json
JSON database of the channel segment data.
.hex
Comma-delimited list of HEX strings.
.rgb
, .txt
3-4 column table of channel values.
alpha (bool
, optional) – Whether to include an opacity column for .rgb
and .txt
files.
Set the opacity for the entire colormap or set up an opacity gradation.
alpha (float
or sequence of float
) – If float, this is the opacity for the entire colormap. If sequence of float, the colormap traverses these opacity values.
coords (sequence of float
, optional) – Colormap coordinates for the opacity values. The first and last coordinates must be 0
and 1
. If alpha
is not scalar, the default coordinates are np.linspace(0, 1, len(alpha))
.
ratios (sequence of float
, optional) – Relative extent of each opacity transition segment. Length should equal len(alpha) + 1
. For example cmap.set_alpha((1, 1, 0), ratios=(2, 1))
creates a transtion from 100 percent to 0 percent opacity in the right third of the colormap.
Set whether this colormap is “cyclic”. See ContinuousColormap
for details.
Return a cyclicaly shifted version of the colormap. If the colormap cyclic property is set to False
a warning will be raised.
**kwargs – Passed to ContinuousColormap.copy
or PerceptualColormap.copy
.
Convert the ContinuousColormap
to a DiscreteColormap
by drawing samples from the colormap.
**kwargs – Passed to DiscreteColormap
.
Return a truncated version of the colormap.
left (float
, default: 0
) – The colormap index for the new “leftmost” color. Must fall between 0
and 1
. For example, left=0.1
cuts the leftmost 10% of the colors.
right (float
, default: 1
) – The colormap index for the new “rightmost” color. Must fall between 0
and 1
. For example, right=0.9
cuts the leftmost 10% of the colors.
name (str
, default: '_name_copy'
) – The new colormap name.
**kwargs – Passed to ContinuousColormap.copy
or PerceptualColormap.copy
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4