colorbar_wrapper

colorbar_wrapper(self, mappable, values=None, extend=None, extendsize=None, title=None, label=None, grid=None, tickminor=None, reverse=False, tickloc=None, ticklocation=None, locator=None, ticks=None, maxn=None, maxn_minor=None, minorlocator=None, minorticks=None, locator_kw=None, minorlocator_kw=None, formatter=None, ticklabels=None, formatter_kw=None, norm=None, norm_kw=None, orientation='horizontal', edgecolor=None, linewidth=None, labelsize=None, labelweight=None, labelcolor=None, ticklabelsize=None, ticklabelweight=None, ticklabelcolor=None, **kwargs)[source]

Adds useful features for controlling colorbars.

Parameters
  • mappable (mappable, list of plot handles, list of color-spec, or colormap-spec) – There are four options here:

    1. A mappable object. Basically, any object with a get_cmap method, like the objects returned by contourf and pcolormesh.

    2. A list of “plot handles”. Basically, any object with a get_color method, like Line2D instances. A colormap will be generated from the colors of these objects, and colorbar levels will be selected using values. If values is None, we try to infer them by converting the handle labels returned by get_label to float. Otherwise, it is set to np.linspace(0, 1, len(mappable)).

    3. A list of hex strings, color string names, or RGB tuples. A colormap will be generated from these colors, and colorbar levels will be selected using values. If values is None, it is set to np.linspace(0, 1, len(mappable)).

    4. A Colormap instance. In this case, a colorbar will be drawn using this colormap and with levels determined by values. If values is None, it is set to np.linspace(0, 1, cmap.N).

  • values (list of float, optional) – Ignored if mappable is a mappable object. This maps each color or plot handle in the mappable list to numeric values, from which a colormap and normalizer are constructed.

  • norm (normalizer spec, optional) – Ignored if values is None. The normalizer for converting values to colormap colors. Passed to Norm.

  • norm_kw (dict-like, optional) – The normalizer settings. Passed to Norm.

  • extend ({None, ‘neither’, ‘both’, ‘min’, ‘max’}, optional) – Direction for drawing colorbar “extensions” (i.e. references to out-of-bounds data with a unique color). These are triangles by default. If None, we try to use the extend attribute on the mappable object. If the attribute is unavailable, we use 'neither'.

  • extendsize (float or str, optional) – The length of the colorbar “extensions” in physical units. If float, units are inches. If string, units are interpreted by units. Default is rc[‘colorbar.insetextend’] = '1em' for inset colorbars and rc[‘colorbar.extend’] = '1.3em' for outer colorbars.

  • reverse (bool, optional) – Whether to reverse the direction of the colorbar.

  • tickloc, ticklocation ({‘bottom’, ‘top’, ‘left’, ‘right’}, optional) – Where to draw tick marks on the colorbar.

  • tickminor (bool, optional) – Whether to add minor ticks to the colorbar with minorticks_on.

  • label, title (str, optional) – The colorbar label. The title keyword is also accepted for consistency with legend.

  • grid (bool, optional) – Whether to draw “gridlines” between each level of the colorbar. Default is rc[‘colorbar.grid’] = False.

  • locator, ticks (locator spec, optional) – Used to determine the colorbar tick positions. Passed to the Locator constructor.

  • maxn (int, optional) – Used if locator is None. Determines the maximum number of levels that are ticked. Default depends on the colorbar length relative to the font size. The keyword name “maxn” is meant to mimic the MaxNLocator class name.

  • locator_kw (dict-like, optional) – The locator settings. Passed to Locator.

  • minorlocator, minorticks, maxn_minor, minorlocator_kw – As with locator, maxn, and locator_kw, but for the minor ticks.

  • formatter, ticklabels (formatter spec, optional) – The tick label format. Passed to the Formatter constructor.

  • formatter_kw (dict-like, optional) – The formatter settings. Passed to Formatter.

  • edgecolor, linewidth (optional) – The edge color and line width for the colorbar outline.

  • labelsize, labelweight, labelcolor (optional) – The font size, weight, and color for colorbar label text.

  • ticklabelsize, ticklabelweight, ticklabelcolor (optional) – The font size, weight, and color for colorbar tick labels.

  • orientation ({{‘horizontal’, ‘vertical’}}, optional) – The colorbar orientation. You should not have to explicitly set this.

Other Parameters

**kwargs – Passed to colorbar.