plots.get_color_feat
plots.get_color_feat(x, cmap_name='viridis', min_val=None, max_val=None)Generate colors for feature values using colormaps.
This function normalizes feature values to the range [0, 1] and maps them to colors using a specified colormap. Useful for creating color-coded visualizations of feature values.
Args: x (np.ndarray): Array of feature values to colorize. cmap_name (str, optional): Name of the matplotlib colormap to use. Defaults to “viridis”. min_val (float, optional): Minimum value for normalization. If None, uses the minimum value in x. Defaults to None. max_val (float, optional): Maximum value for normalization. If None, uses the maximum value in x. Defaults to None.
Returns: np.ndarray: Array of RGBA colors with the same shape as x.
Note: The function performs min-max normalization and maps the normalized values to colors using the specified colormap. Values are clipped to the [0, 1] range during normalization.