deephyper.analysis.hpo.LinearSegmentedColormap#

class deephyper.analysis.hpo.LinearSegmentedColormap(name, segmentdata, N=256, gamma=1.0)[source]#

Bases: Colormap

Colormap objects based on lookup tables using linear segments.

The lookup table is generated using linear interpolation for each primary color, with the 0-1 domain divided into any number of segments.

Methods

copy

Return a copy of the colormap.

from_list

Create a LinearSegmentedColormap from a list of colors.

get_bad

Get the color for masked values.

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.

resampled

Return a new colormap with lutsize entries.

reversed

Return a reversed instance of the Colormap.

set_bad

Set the color for masked values.

set_extremes

Set the colors for masked (bad) values and, when norm.clip = False, low (under) and high (over) out-of-range values.

set_gamma

Set a new gamma value and regenerate colormap.

set_over

Set the color for high out-of-range values.

set_under

Set the color for low out-of-range values.

with_extremes

Return a copy of the colormap, for which the colors for masked (bad) values and, when norm.clip = False, low (under) and high (over) out-of-range values, have been set accordingly.

Attributes

colorbar_extend

When this colormap exists on a scalar mappable and colorbar_extend is not False, colorbar creation will pick up colorbar_extend as the default value for the extend keyword in the matplotlib.colorbar.Colorbar constructor.

__call__(X, alpha=None, bytes=False)#
Parameters:
  • X (float or int, ~numpy.ndarray or scalar) – The data value(s) to convert to RGBA. For floats, X should be in the interval [0.0, 1.0] to return the RGBA values X*100 percent along the Colormap line. For integers, X should be in the interval [0, Colormap.N) to return RGBA values indexed from the Colormap with index X.

  • alpha (float or array-like or None) – Alpha must be a scalar between 0 and 1, a sequence of such floats with shape matching X, or None.

  • bytes (bool) – If False (default), the returned RGBA values will be floats in the interval [0, 1] otherwise they will be numpy.uint8s in the interval [0, 255].

Returns:

  • Tuple of RGBA values if X is scalar, otherwise an array of

  • RGBA values with a shape of X.shape + (4, ).

colorbar_extend#

When this colormap exists on a scalar mappable and colorbar_extend is not False, colorbar creation will pick up colorbar_extend as the default value for the extend keyword in the matplotlib.colorbar.Colorbar constructor.

copy()#

Return a copy of the colormap.

static from_list(name, colors, N=256, gamma=1.0)[source]#

Create a LinearSegmentedColormap from a list of colors.

Parameters:
  • name (str) – The name of the colormap.

  • colors (array-like of colors or array-like of (value, color)) – If only colors are given, they are equidistantly mapped from the range \([0, 1]\); i.e. 0 maps to colors[0] and 1 maps to colors[-1]. If (value, color) pairs are given, the mapping is from value to color. This can be used to divide the range unevenly.

  • N (int) – The number of RGB quantization levels.

  • gamma (float) –

get_bad()#

Get the color for masked values.

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.

resampled(lutsize)[source]#

Return a new colormap with lutsize entries.

reversed(name=None)[source]#

Return a reversed instance of the Colormap.

Parameters:

name (str, optional) – The name for the reversed colormap. If None, the name is set to self.name + "_r".

Returns:

The reversed colormap.

Return type:

LinearSegmentedColormap

set_bad(color='k', alpha=None)#

Set the color for masked values.

set_extremes(*, bad=None, under=None, over=None)#

Set the colors for masked (bad) values and, when norm.clip = False, low (under) and high (over) out-of-range values.

set_gamma(gamma)[source]#

Set a new gamma value and regenerate colormap.

set_over(color='k', alpha=None)#

Set the color for high out-of-range values.

set_under(color='k', alpha=None)#

Set the color for low out-of-range values.

with_extremes(*, bad=None, under=None, over=None)#

Return a copy of the colormap, for which the colors for masked (bad) values and, when norm.clip = False, low (under) and high (over) out-of-range values, have been set accordingly.