splot.mapping.shift_colormap¶
- splot.mapping.shift_colormap(cmap, start=0, midpoint=0.5, stop=1.0, name='shiftedcmap')[source]¶
Function to offset the “center” of a colormap. Useful for data with a negative min and positive max and you want the middle of the colormap’s dynamic range to be at zero
- Parameters
- cmapstr or matplotlib.cm instance
colormap to be altered
- startfloat, optional
Offset from lowest point in the colormap’s range. Should be between 0.0 and midpoint. Default =0.0 (no lower ofset).
- midpointfloat, optional
The new center of the colormap.Should be between 0.0 and 1.0. In general, this should be 1 - vmax/(vmax + abs(vmin)). For example if your data range from -15.0 to +5.0 and you want the center of the colormap at 0.0, midpoint should be set to 1 - 5/(5 + 15)) or 0.75. Default =0.5 (no shift).
- stopfloat, optional
Offset from highets point in the colormap’s range. Should be between midpoint and 1.0. Default =1.0 (no upper ofset).
- namestr, optional
Name of the new colormap.
- Returns
- new_cmapA new colormap that has been shifted.