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 or list of float) – If float, this is the opacity for the entire colormap. If list of float, the colormap traverses these opacity values.

  • coords (list 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 (list 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.