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]

Adds colorbar as an inset or 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.axespad’] = '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. Default is rc[‘colorbar.width’] = '1.5em' or rc[‘colorbar.insetwidth’] = '1.2em'.

  • space (float or str, optional) – The space between the colorbar and the main axes. For outer colorbars only. Units are interpreted by units. When rc.tight is True, this is adjusted automatically. Otherwise, defaut is rc[‘subplots.panelspace’] = '1em'.

  • frame, frameon (bool, optional) – Whether to draw a frame around inset colorbars, 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.