create_cmap

laserbeamsize.image_tools.create_cmap(vmin, vmax, band_percentage=4)[source]

Create a colormap with a specific range, mapping vmin to 0 and vmax to 1.

The colormap is interesting because negative values are blue and positive values are red. Zero is shown as a white band: blue, dark blue, white, dark red, and red. The transition points between the colors are determined by the normalized range.

Parameters:
  • vmin (float) – The minimum value of the range to be normalized.

  • vmax (float) – The maximum value of the range to be normalized.

  • band_percentage (option) – fraction of the entire band that is white

Returns:

matplotlib.colors.LinearSegmentedColormap – The generated colormap with 255 colors.