Figure.colorbar(*args, loc='r', width=None, space=None, row=None, col=None, rows=None, cols=None, span=None, **kwargs)[source]

Draw a colorbar along the left, right, bottom, or top side of the figure, centered between the leftmost and rightmost (or topmost and bottommost) main axes.

  • loc (str, optional) – The colorbar location. Valid location keys are as follows.


    Valid keys

    left edge

    'l', 'left'

    right edge

    'r', 'right'

    bottom edge

    'b', 'bottom'

    top edge

    't', 'top'

  • row, rows (optional) – Aliases for span for panels on the left or right side.

  • col, cols (optional) – Aliases for span for panels on the top or bottom side.

  • span (int or (int, int), optional) – Describes how the colorbar spans rows and columns of subplots. For example, fig.colorbar(loc='b', col=1) draws a colorbar beneath the leftmost column of subplots, and fig.colorbar(loc='b', cols=(1,2)) draws a colorbar beneath the left two columns of subplots. By default, the colorbar will span all rows and columns.

  • space (float or str, optional) – The space between the main subplot grid and the colorbar, or the space between successively stacked colorbars. Units are interpreted by units. By default, this is determined by the “tight layout” algorithm, or is rc[‘subplots.panelpad’] = '0.5em' if “tight layout” is off.

  • width (float or str, optional) – The colorbar width. Units are interpreted by units. Default is rc[‘colorbar.width’] = '1.5em'.

  • *args, **kwargs – Passed to colorbar.