Skip to content
Source

Colorbars


Basics


Plot Colorbar Only


Plot n Colorbars, 1 Plot


Colorbar Position


Scaling

cbar = plt.colorbar(pts,  fraction=0.046,)

Normalizing

import matplotlib.colors as colors

boundaries = (0.0, 1.0)

# plot data
pts = ax.pcolor(
    X,Y,Z,
    norm=colors.Normalize(vmin=boundaries[0], vmax=boundaries[1])
    cmap='grays'
)

# plot colorbar
cbar = plt.colorbar(pts, ax=ax, extend='both')

Normalizations

  • Log Scale
  • Symmetric Log Scale

Resources