lstein.utils.get_colors

lstein.utils.get_colors(x: ndarray, cmap: str | Colormap = None, norm=<class 'matplotlib.colors.Normalize'>, **kwargs) ndarray[source]

returns array of colors mapping x onto cmap

  • function to generate an array of colors mapping x onto cmap

Parameters
  • x
    • np.ndarray

    • data-series to be mapped onto cmap

  • cmap
    • str, mcolors.Colormap, optional

    • colormap to use

    • the default is None
      • will use plt.rcParams[“image.cmap”]

  • norm
    • mcolors Norm, optional

    • some instance of a matplotlib.colors Norm

    • normalization to use when mapping x to cmap

    • the default is mcolors.Normalize

  • **kwargs
    • kwargs to to pass to norm()

Raises

Returns
  • colors
    • np.ndarray

    • has length x.shape[0]
      • one hex-value for each value in x

Dependencies
  • matplotlib

  • typing