colorbar_extras¶
- colorbar_extras(self, mappable, values=None, *, extend=None, extendsize=None, title=None, label=None, grid=None, tickminor=None, reverse=False, tickloc=None, ticklocation=None, tickdir=None, tickdirection=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, rotation=None, norm=None, norm_kw=None, orientation=None, edgecolor=None, linewidth=None, labelsize=None, labelweight=None, labelcolor=None, ticklabelsize=None, ticklabelweight=None, ticklabelcolor=None, **kwargs)[source]¶
Adds useful features for controlling colorbars.
Important
This function wraps
proplot.axes.Axes.colorbarandproplot.figure.Figure.colorbar.- Parameters
mappable (mappable, list of plot handles, list of color-spec, or colormap-spec) – There are four options here:
A mappable object. Basically, any object with a
get_cmapmethod, like the objects returned bycontourfandpcolormesh.A list of “plot handles”. Basically, any object with a
get_colormethod, likeLine2Dinstances. A colormap will be generated from the colors of these objects, and colorbar levels will be selected usingvalues. IfvaluesisNone, we try to infer them by converting the handle labels returned byget_labeltofloat. Otherwise, it is set tonp.linspace(0, 1, len(mappable)).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. IfvaluesisNone, it is set tonp.linspace(0, 1, len(mappable)).A
Colormapinstance. In this case, a colorbar will be drawn using this colormap and with levels determined byvalues. IfvaluesisNone, it is set tonp.linspace(0, 1, cmap.N).
values (list of float, optional) – Ignored if
mappableis a mappable object. This maps each color or plot handle in themappablelist to numeric values, from which a colormap and normalizer are constructed.norm (normalizer spec, optional) – Ignored if
valuesisNone. The normalizer for convertingvaluesto colormap colors. Passed toNorm.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 theextendattribute 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 isrc[‘colorbar.insetextend’]='1em'for inset colorbars andrc[‘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.
tickdir, tickdirection ({‘out’, ‘in’, ‘inout’}, optional) – Direction that major and minor tick marks point.
tickminor (bool, optional) – Whether to add minor ticks to the colorbar with
minorticks_on.grid (bool, optional) – Whether to draw “gridlines” between each level of the colorbar. Default is
rc[‘colorbar.grid’]=False.label, title (str, optional) – The colorbar label. The
titlekeyword is also accepted for consistency withlegend.locator, ticks (locator spec, optional) – Used to determine the colorbar tick positions. Passed to the
Locatorconstructor.maxn (int, optional) – Used if
locatorisNone. 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 theMaxNLocatorclass name.locator_kw (dict-like, optional) – The locator settings. Passed to
Locator.minorlocator, minorticks, maxn_minor, minorlocator_kw – As with
locator,maxn, andlocator_kw, but for the minor ticks.formatter, ticklabels (formatter spec, optional) – The tick label format. Passed to the
Formatterconstructor.formatter_kw (dict-like, optional) – The formatter settings. Passed to
Formatter.rotation (float, optional) – The tick label rotation. Default is
0.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 ({{None, ‘horizontal’, ‘vertical’}}, optional) – The colorbar orientation. By default this depends on the “side” of the subplot or figure where the colorbar is drawn. Inset colorbars are always horizontal.
- Other Parameters
**kwargs – Passed to
matplotlib.figure.Figure.colorbar.