lonboard.colormap¶
lonboard.colormap.apply_continuous_cmap ¶
apply_continuous_cmap(
values: NDArray[np.floating],
cmap: Palette,
*,
alpha: Union[float, int, NDArray[np.floating], None] = None
) -> NDArray[np.uint8]
Apply a colormap to a set of values.
This is described as "continuous" because it uses matplotlib's LinearSegmentedColormap under the hood. As described in Matplotlib's referenced docstring:
The lookup table is generated using linear interpolation for each primary color, with the 0-1 domain divided into any number of segments.
This means that input values are linearly combined from the two nearest colormap colors.
If you want to snap to the "nearest" colormap value, you should use another function (not yet implemented) to snap to the strictly nearest color value.
Parameters:
-
values
(NDArray[floating]
) –A numpy array of floating point values ranging from 0 to 1.
-
cmap
(Palette
) –Any
Palette
object from thepalettable
package. -
alpha
(Union[float, int, NDArray[floating], None]
, default:None
) –Alpha must be a scalar between 0 and 1, a sequence of such floats with shape matching
values
, or None.
Returns: