Created
October 4, 2021 17:34
-
-
Save blaylockbk/1ca617b6716aa8aa6b45bd6131ddb86a to your computer and use it in GitHub Desktop.
sandalone matplotlib colorbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As I answered on StackOverflow