Skip to content

Instantly share code, notes, and snippets.

@Shaunakde
Created December 9, 2015 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shaunakde/61d3244c983c2f91636f to your computer and use it in GitHub Desktop.
Save Shaunakde/61d3244c983c2f91636f to your computer and use it in GitHub Desktop.
Plot a colormap for inclusion in figures using matplotlib
def show_colormap(cmap):
im = np.outer(np.ones(10), np.arange(100))
fig, ax = plt.subplots(1,1, figsize=(6, 1.5),
subplot_kw=dict(xticks=[], yticks=[]))
fig.subplots_adjust(hspace=0.1)
ax.imshow(im, cmap=cmap)
show_colormap('jet')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment