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 is rc[‘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 by units. Default is rc[‘colorbar.insetlength’] = '8em'.

  • width (float or str, optional) – The colorbar width. Units are interpreted by units. For outer colorbars, default is rc[‘colorbar.width’] = '1.5em'. For inset colorbars, default is rc[‘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. When rc.tight is True, this is adjusted automatically. Otherwise, the default is rc[‘subplots.panelpad’] = '0.5em'.

  • frame, frameon (bool, optional) – For inset colorbars, indicates whether to draw a “frame”, just like legend. Default is rc[‘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', and rc[‘axes.facecolor’] = 'w', respectively.

  • **kwargs – Passed to colorbar_wrapper.