Created
April 25, 2016 22:58
-
-
Save avishekrk/2921910c1077bf56154cef17515321e3 to your computer and use it in GitHub Desktop.
Make a vertical colorbar
This file contains hidden or 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 pylab as pl | |
import numpy as np | |
pl.rcParams.update({'font.size': 22}) | |
a = np.array([[-0.5,1.75]]) | |
pl.figure(figsize=(4.0, 16)) | |
img = pl.imshow(a,cmap="seismic") | |
pl.gca().set_visible(False) | |
#cax = pl.axes([0.1, 0.2, 0.8, 0.6]) | |
cax= pl.axes([0.35,0.1,0.25,.95]) | |
pl.colorbar(cax=cax,orientation='vertical') | |
pl.xticks([]) | |
pl.yticks([]) | |
pl.savefig("colorbar.png") | |
pl.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment