ContinuousColormap.set_alpha¶
- ContinuousColormap.set_alpha(alpha, coords=None, ratios=None)[source]¶
Set the opacity for the entire colormap or set up an opacity gradation.
- Parameters
alpha (
float
orlist
offloat
) – If float, this is the opacity for the entire colormap. If list of float, the colormap traverses these opacity values.coords (
list
offloat
, optional) – Colormap coordinates for the opacity values. The first and last coordinates must be0
and1
. Ifalpha
is not scalar, the default coordinates arenp.linspace(0, 1, len(alpha))
.ratios (
list
offloat
, optional) – Relative extent of each opacity transition segment. Length should equallen(alpha) + 1
. For examplecmap.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.
See also