Add an inset colorbar or an outer colorbar along the edge of the axes.
mappable (mappable
, colormap-spec
, sequence of color-spec
, or sequence of Artist
) – There are four options here:
A ScalarMappable
(e.g., an object returned by contourf
or pcolormesh
).
A Colormap
or registered colormap name used to build a ScalarMappable
on-the-fly. The colorbar range and ticks depend on the arguments values
, vmin
, vmax
, and norm
. The default for a ContinuousColormap
is vmin=0
and vmax=1
(note that passing values
will “discretize” the colormap). The default for a DiscreteColormap
is values=np.arange(0, cmap.N)
.
A sequence of hex strings, color names, or RGB[A] tuples. A DiscreteColormap
will be generated from these colors and used to build a ScalarMappable
on-the-fly. The colorbar range and ticks depend on the arguments values
, norm
, and norm_kw
. The default is values=np.arange(0, len(mappable))
.
A sequence of matplotlib.artist.Artist
instances (e.g., a list of Line2D
instances returned by plot
). A colormap will be generated from the colors of these objects (where the color is determined by get_color
, if available, or get_facecolor
). The colorbar range and ticks depend on the arguments values
, norm
, and norm_kw
. The default is to infer colorbar ticks and tick labels by calling get_label
on each artist.
values (sequence of float
or str
, optional) – Ignored if mappable
is a ScalarMappable
. This maps the colormap colors to numeric values using DiscreteNorm
. If the colormap is a ContinuousColormap
then its colors will be “discretized”. These These can also be strings, in which case the list indices are used for tick locations and the strings are applied as tick labels.
loc, location (int
or str
, default: rc['colorbar.loc']
= 'right'
) – The colorbar location. Valid location keys are shown in the below table.
Location
Valid keys
outer left
'left'
, 'l'
outer right
'right'
, 'r'
outer bottom
'bottom'
, 'b'
outer top
'top'
, 't'
default inset
'best'
, 'inset'
, 'i'
, 0
upper right inset
'upper right'
, 'ur'
, 1
upper left inset
'upper left'
, 'ul'
, 2
lower left inset
'lower left'
, 'll'
, 3
lower right inset
'lower right'
, 'lr'
, 4
“filled”
'fill'
shrink – Alias for length
. This is included for consistency with matplotlib.figure.Figure.colorbar
.
length (float
or unit-spec
, default: rc['colorbar.length']
= 1.0
or rc['colorbar.insetlength']
= 8.0
) – The colorbar length. For outer colorbars, units are relative to the axes width or height (default is rc['colorbar.length']
). For inset colorbars, floats interpreted as em-widths and strings interpreted by units
(default is rc['colorbar.insetlength']
).
width (unit-spec
, default: rc['colorbar.width']
= 0.2
or :rc:`colorbar.insetwidth
) – The colorbar width. For outer colorbars, floats are interpreted as inches (default is rc['colorbar.width']
). For inset colorbars, floats are interpreted as em-widths (default is rc['colorbar.insetwidth']
). Strings are interpreted by units
.
queue (bool
, optional) – If True
and loc
is the same as an existing colorbar, the input arguments are added to a queue and this function returns None
. This is used to “update” the same colorbar with successive ax.colorbar(...)
calls. If False
(the default) and loc
is the same as an existing inset colorbar, the old colorbar is removed. If False
and loc
is an outer colorbar, the colorbars are “stacked”.
space (unit-spec
, default: None
) – For outer colorbars only. The fixed space between the colorbar and the subplot edge. If float, units are em-widths. If string, interpreted by units
. When the tight layout algorithm is active for the figure, space
is computed automatically (see pad
). Otherwise, space
is set to a suitable default.
pad (unit-spec
, default: rc['subplots.panelpad']
= 0.5
or rc['colorbar.insetpad']
= 0.7
) – For outer colorbars, this is the tight layout padding between the colorbar and the subplot (default is rc['subplots.panelpad']
). For inset colorbars, this is the fixed space between the axes edge and the colorbar (default is rc['colorbar.insetpad']
). If float, units are em-widths. If string, interpreted by units
.
align ({'center', 'top', 'bottom', 'left', 'right', 't', 'b', 'l', 'r'}
, optional) – For outer colorbars only. How to align the colorbar against the subplot edge. The values 'top'
and 'bottom'
are valid for left and right colorbars and 'left'
and 'right'
are valid for top and bottom colorbars. The default is always 'center'
. Has no visible effect if length
is 1
.
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.
norm (norm-spec
, optional) – Ignored if mappable
is a ScalarMappable
. This is the continuous normalizer used to scale the ContinuousColormap
(or passed to DiscreteNorm
if values
was passed). Passed to the Norm
constructor function.
norm_kw (dict-like, optional) – Ignored if mappable
is a ScalarMappable
. These are the normalizer keyword arguments. Passed to Norm
.
vmin, vmax (float
, optional) – Ignored if mappable
is a ScalarMappable
. These are the minimum and maximum colorbar values. Passed to Norm
.
label, title (str
, optional) – The colorbar label. The title
keyword is also accepted for consistency with legend
.
reverse (bool
, optional) – Whether to reverse the direction of the colorbar. This is done automatically when descending levels are used with DiscreteNorm
.
rotation (float
, default: 0
) – The tick label rotation.
grid, edges, drawedges (bool
, default: rc['colorbar.grid']
= False
) – Whether to draw “grid” dividers between each distinct color.
extend ({'neither', 'both', 'min', 'max'}
, optional) – Direction for drawing colorbar “extensions” (i.e. color keys for out-of-bounds data on the end of the colorbar). Default behavior is to use the value of extend
passed to the plotting command or use 'neither'
if the value is unknown.
extendfrac (float
, optional) – The length of the colorbar “extensions” relative to the length of the colorbar. This is a native matplotlib colorbar
keyword.
extendsize (unit-spec
, default: rc['colorbar.extend']
= 1.3
or rc['colorbar.insetextend']
= 0.9
) – The length of the colorbar “extensions” in physical units. Default is rc['colorbar.extend']
for outer colorbars and rc['colorbar.insetextend']
for inset colorbars. If float, units are em-widths. If string, interpreted by units
.
extendrect (bool
, default: False
) – Whether to draw colorbar “extensions” as rectangles. If False
then the extensions are drawn as triangles.
locator, ticks (locator-spec
, optional) – Used to determine the colorbar tick positions. Passed to the Locator
constructor function. By default AutoLocator
is used for continuous color levels and DiscreteLocator
is used for discrete color levels.
locator_kw (dict-like, optional) – Keyword arguments passed to matplotlib.ticker.Locator
class.
minorlocator, minorticks – As with locator
, ticks
but for the minor ticks. By default AutoMinorLocator
is used for continuous color levels and DiscreteLocator
is used for discrete color levels.
minorlocator_kw – As with locator_kw
, but for the minor ticks.
format, formatter, ticklabels (formatter-spec
, optional) – The tick label format. Passed to the Formatter
constructor function.
formatter_kw (dict-like, optional) – Keyword arguments passed to matplotlib.ticker.Formatter
class.
frame, frameon (bool
, default: rc['colorbar.frameon']
= True
) – For inset colorbars only. Indicates whether to draw a “frame”, just like legend
.
tickminor (bool
, optional) – Whether to add minor ticks using minorticks_on
.
tickloc, ticklocation ({'bottom', 'top', 'left', 'right'}
, optional) – Where to draw tick marks on the colorbar. Default is toward the outside of the subplot for outer colorbars and 'bottom'
for inset colorbars.
tickdir, tickdirection ({'out', 'in', 'inout'}
, default: rc['tick.dir']
= 'out'
) – Direction of major and minor colorbar ticks.
ticklen (unit-spec
, default: rc['tick.len']
= 4.0
) – Major tick lengths for the colorbar ticks.
ticklenratio (float
, default: rc['tick.lenratio']
= 0.5
) – Relative scaling of ticklen
used to determine minor tick lengths.
tickwidth (unit-spec
, default: linewidth
) – Major tick widths for the colorbar ticks. or rc['tick.width']
= 0.6
if linewidth
was not passed.
tickwidthratio (float
, default: rc['tick.widthratio']
= 0.8
) – Relative scaling of tickwidth
used to determine minor tick widths.
ticklabelcolor, ticklabelsize, ticklabelweight (default: rc['tick.labelcolor']
= 'black'
, rc['tick.labelsize']
= 'medium'
, rc['tick.labelweight']
= 'normal'
.) – The font color, size, and weight for colorbar tick labels
labelloc, labellocation ({'bottom', 'top', 'left', 'right'}
) – The colorbar label location. Inherits from tickloc
by default. Default is toward the outside of the subplot for outer colorbars and 'bottom'
for inset colorbars.
labelcolor, labelsize, labelweight (default: rc['label.color']
= 'black'
, rc['label.size']
= 'medium'
, and rc['label.weight']
= 'normal'
.) – The font color, size, and weight for the colorbar label.
a, alpha, framealpha, fc, facecolor, framecolor, ec, edgecolor, ew, edgewidth (default: rc['colorbar.framealpha']
= 0.8
, rc['colorbar.framecolor']
) – For inset colorbars only. Controls the transparency and color of the background frame.
lw, linewidth, c, color (optional) – Controls the line width and edge color for both the colorbar outline and the level dividers.
edgefix (bool
or float
, default: rc.edgefix
= True
) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. If True
, a small default linewidth of 0.3
is used to cover up the white lines. If float (e.g. edgefix=0.5
), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.
rasterize (bool
, default: rc['colorbar.rasterize']
= False
) – Whether to rasterize the colorbar solids. The matplotlib default was True
but proplot changes this to False
since rasterization can cause misalignment between the color patches and the colorbar outline.
**kwargs – Passed to colorbar
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4