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 [R35] can be used. The code is loosely based on [R45].


cmap : str or Colormap

Colormap name or instance.

mode : {‘skimage, ‘hsp’}

Grayscale conversion method. Either skimage or hsp.


[R35](1, 2) Darel Rex Finley, “HSP Color Model - Alternative to HSV (HSB) and HSL”
[R45](1, 2) Jake VanderPlas, “How Bad Is Your Colormap?”