Skip to content

Instantly share code, notes, and snippets.

@blaylockbk
Created October 4, 2021 17:34
Show Gist options
  • Save blaylockbk/1ca617b6716aa8aa6b45bd6131ddb86a to your computer and use it in GitHub Desktop.
Save blaylockbk/1ca617b6716aa8aa6b45bd6131ddb86a to your computer and use it in GitHub Desktop.
sandalone matplotlib colorbar
import matplotlib.pyplot as plt
import matplotlib as mpl
fig = plt.figure()
ax = fig.add_axes([0.05, 0.80, 0.9, 0.1])
cb = mpl.colorbar.ColorbarBase(ax, orientation='horizontal',
cmap='gist_ncar',
norm=mpl.colors.Normalize(0, 10), # vmax and vmin
extend='both',
label='This is a label',
ticks=[0, 3, 6, 9])
plt.savefig('just_colorbar', bbox_inches='tight')
@blaylockbk
Copy link
Author

As I answered on StackOverflow
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment