Hi all:

I'm looking for a simple way to scale a color bar so it will be the same
height as the image.  It seems to work automatically if the image is at
least as tall as it is wide, but when it is wider than tall it seems to
scale to the width rather than height. (Shouldn't the default behavior
be to scale to height if the colorbar is vertical and width if its
horizontal?)  One approach that I found at one point was something like
this:
fig = plt.figure(figsize=(11,5))
cax = fig.add_axes([0.9,0.1,0.01,0.8]) # axes for colorbar
ax = plt.subplot(111)
im = ax.imshow(image)
fig.colorbar(im,cax=cax)

but even with this method it seems that tweaking the figsize and
add_axes arguments.  I've also fiddled with the shrink and fraction
keywords and have managed to get good results, but it seems so ad hoc.
Is there a better way?

Jon


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to