lgca.plots.colorbar_index¶
- lgca.plots.colorbar_index(ncolors, cmap, use_gridspec=False, cax=None)¶
Create a colorbar with ncolors colors.
Builds a discrete colormap with ncolors colors from the near-continuous colormap cmap, adds it to the axis cax and draws tick labels in the center of each color. If ncolors is high, tick positions are determined automatically using
MaxNLocatorand labels are formatted withFuncFormatter.- Parameters:
ncolors (
int) – Desired number of colors for the discretized colormap.cmap (str or
matplotlib.colors.Colormap) – Near-continuous colormap to create discrete colormap from, e.g.matplotlib.cm.jetor'jet'.use_gridspec (
bool) – Passed on tomatplotlib.pyplot.colorbar().cax (
matplotlib.axes.Axesobject, optional) – Axis into which the colorbar will be drawn.
- Returns:
Colorbar instance.