grayify_colormap

gammapy.image.grayify_colormap(cmap, mode='hsp')[source]

Return a grayscale version a the colormap.

The grayscale conversion of the colormap is bases on perceived luminance of the colors. For the conversion either the rgb2gray or a generic method called hsp [1] can be used. The code is loosely based on [2].

Parameters:
cmap : str or Colormap

Colormap name or instance.

mode : {‘skimage, ‘hsp’}

Grayscale conversion method. Either skimage or hsp.

References

[1](1, 2) Darel Rex Finley, “HSP Color Model - Alternative to HSV (HSB) and HSL” http://alienryderflex.com/hsp.html
[2](1, 2) Jake VanderPlas, “How Bad Is Your Colormap?” https://jakevdp.github.io/blog/2014/10/16/how-bad-is-your-colormap/