chaco.colormap_generators module

Generate parameteric colormaps.

Diverging colormaps can be generated via Kenneth Moreland’s procedure using generate_diverging_palette().

Moreland, Kenneth. Diverging Color Maps for Scientific Visualization (Expanded). http://www.sandia.gov/~kmorel/documents/ColorMaps/ColorMapsExpanded.pdf

Dave Green’s cubehelix family of colormaps can be generated using generate_cubehelix_palette().

Green, D. A., 2011, A colour scheme for the display of astronomical intensity images. Bulletin of the Astronomical Society of India, 39, 289. (2011BASI…39..289G at ADS.) http://adsabs.harvard.edu/abs/2011arXiv1108.5083G https://www.mrao.cam.ac.uk/~dag/CUBEHELIX/

chaco.colormap_generators.adjust_hue(msh_sat, m_unsat)

Adjust the hue when interpolating to an unsaturated color.

Parameters
  • msh_sat (float array (3,)) – Saturated Msh color at an endpoint of the colormap.

  • m_unsat (float) – The magnitude of the target unsaturated color.

Returns

h_adjusted – The adjusted target hue value.

Return type

float

chaco.colormap_generators.generate_cubehelix_palette(start=0.5, rot=- 1.5, saturation=1.2, lightness_range=(0.0, 1.0), gamma=1.0, n_colors=256)

Generate a sequential color palette from black to white spiraling through intermediate colors.

Parameters
  • start (float between 0.0 and 3.0, optional) – The starting hue. 0 is blue, 1 is red, 2 is green.

  • rot (float, optional) – How many rotations to go in hue space.

  • saturation (float, optional) – The saturation intensity factor.

  • lightness_range ((float, float), optional) – The range of lightness values to interpolate between.

  • gamma (float, optional) – The gamma exponent adjustment to apply to the lightness values.

  • n_colors (int, optional) – The number of colors to generate in the palette.

Returns

srgb_palette – RGB color palette.

Return type

float array (n_colors, 3)

chaco.colormap_generators.generate_diverging_palette(srgb1, srgb2, n_colors=256)

Generate a diverging color palette with two endpoint colors.

Parameters
  • srgb1 (float array (3,)) – RGB colors for the endpoints. An unsaturated white/grey color will be in the middle.

  • srgb2 (float array (3,)) – RGB colors for the endpoints. An unsaturated white/grey color will be in the middle.

  • n_colors (int, optional) – The number of colors to generate in the palette.

Returns

srgb_palette – RGB color palette.

Return type

float array (n_colors, 3)