Axes.colorbar¶
-
Axes.
colorbar
(*args, loc=None, pad=None, length=None, width=None, space=None, frame=None, frameon=None, alpha=None, linewidth=None, edgecolor=None, facecolor=None, **kwargs)[source]¶ Add an inset colorbar or outer colorbar along the outside edge of the axes. See
colorbar_wrapper
for details.- Parameters
loc (str, optional) – The colorbar location. Default is
rc[‘colorbar.loc’]
='right'
. The following location keys are valid.Location
Valid keys
outer left
'left'
,'l'
outer right
'right'
,'r'
outer bottom
'bottom'
,'b'
outer top
'top'
,'t'
default inset
'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
pad (float or str, optional) – The space between the axes edge and the colorbar. For inset colorbars only. Units are interpreted by
units
. Default isrc[‘colorbar.insetpad’]
='0.5em'
.length (float or str, optional) – The colorbar length. For outer colorbars, units are relative to the axes width or height. Default is
rc[‘colorbar.length’]
=1
. For inset colorbars, units are interpreted byunits
. Default isrc[‘colorbar.insetlength’]
='8em'
.width (float or str, optional) – The colorbar width. Units are interpreted by
units
. For outer colorbars, default isrc[‘colorbar.width’]
='1.5em'
. For inset colorbars, default isrc[‘colorbar.insetwidth’]
='1.2em'
.space (float or str, optional) – For outer colorbars only. The space between the colorbar and the main axes. Units are interpreted by
units
. Whenrc.tight
isTrue
, this is adjusted automatically. Otherwise, the default isrc[‘subplots.panelpad’]
='0.5em'
.frame, frameon (bool, optional) – For inset colorbars, indicates whether to draw a “frame”, just like
legend
. Default isrc[‘colorbar.frameon’]
=True
.alpha, linewidth, edgecolor, facecolor (optional) – Transparency, edge width, edge color, and face color for the frame around the inset colorbar. Default is
rc[‘colorbar.framealpha’]
=0.8
,rc[‘axes.linewidth’]
=0.6
,rc[‘axes.edgecolor’]
='k'
, andrc[‘axes.facecolor’]
='w'
, respectively.**kwargs – Passed to
colorbar_wrapper
.