lib5c.plotters.colormaps module

Module for resolving string identifiers to matplotlib colormaps.

lib5c.plotters.colormaps.get_colormap(name, reverse=False, set_bad=None)[source]

Get a colormap given its name.

Parameters
  • name (str) – The name of the colormap. See the Notes for special values.

  • reverse (bool) – Pass True to reverse the colormap.

  • set_bad (str, optional) – Color to set as the set_bad color on the returned colormap. This is commonly used to represent NaN or undefined values.

Returns

The requested colormap.

Return type

matplotlib.colors.Colormap

Notes

If name matches a built-in matplotlib colormap, that colormap will be returned. If name matches one of the following special values, the corresponding specialized colomap will be returned:

  • ‘obs_over_exp’: a colormap for visualizing fold changes in interaction frequencies

  • ‘is’: a colormap for plotting interaction score heatmaps

  • ‘obs’: a colormap for visualizing observed interaction frequencies

  • ‘bias’: a colormap for plotting bias factor heatmaps

You can append ‘_bad_<color>’ to any of these to set the set_bad color, for example: ‘abs_obs_bad_green’