sidpy.viz.plot_utils.misc.make_scalar_mappable

sidpy.viz.plot_utils.misc.make_scalar_mappable(vmin, vmax, cmap=None)[source]

Creates a scalar mappable object that can be used to create a colorbar for non-image (e.g. - line) plots

Parameters:
  • vmin (Number) – Minimum value for colorbar

  • vmax (Number) – Maximum value for colorbar

  • cmap (colormap object) – Colormap object to use

Returns:

  • sm (matplotlib.pyplot.cm.ScalarMappable object) – The object that can used to create a colorbar via plt.colorbar(sm)

  • Adapted from (https://stackoverflow.com/questions/8342549/matplotlib-add-colorbar-to-a-sequence-of-line-plots)