sdf_xarray.plotting.shift_cmap

Contents

sdf_xarray.plotting.shift_cmap#

sdf_xarray.plotting.shift_cmap(cmap, vmin, vmax, vcenter, N=1024)[source]#

Create a new colormap where the visual center of the original colormap is shifted to a specific data value.

Parameters:
  • cmap (str) – The name of the original colormap (e.g., ‘viridis’) or the colormap object itself.

  • vmin (float) – The minimum value of your data range.

  • vmax (float) – The maximum value of your data range.

  • vcenter (float) – The data value that should map to the visual midpoint (0.5) of the colormap.

  • N (int) – The number of interpolation steps (color bins) in the new colormap.

Return type:

ListedColormap

Returns:

The newly constructed, shifted colormap.