colorbar_wrapper(self, mappable, values=None, extend=None, extendsize=None, title=None, label=None, grid=None, tickminor=None, 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]

Wraps Axes colorbar and Figure colorbar, adds some handy features.

  • 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.

  • 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.

    This is handy if you have multiple colorbars in one figure. With the matplotlib API, it is really hard to get triangle sizes to match, because the extendsize units are relative.

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

  • 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.

  • tickminor (bool, optional) – Whether to add minor ticks to the colorbar with minorticks_on. Default is 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.

  • maxn_minor (int, optional) – As with maxn, but for minor tick positions. Default depends on the colorbar length.

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

  • minorlocator, minorticks – As with locator, but for the minor ticks.

  • minorlocator_kw – As for 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.

  • norm (normalizer spec, optional) – Ignored if values is None. The normalizer for converting values to colormap colors. Passed to the Norm constructor. As an example, if your values are logarithmically spaced but you want the level boundaries to appear halfway in-between the colorbar ticks, try norm='log'.

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

  • 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.