On Friday 28 January 2005 02:51 pm, Darren Dale wrote:
> I am making graphics of some topographical images. Something simple like:
>
> from pylab import *
> z=rand(256,256)
> figure(figsize=(4,3))
> a1=axes([.1,.1,.7,.85])
> a2=axes([.85,.1,.05,.85])
> a2.yaxis.tick_right()
> a2.xaxis.set_ticks([])
>
> a1.imshow(z,cmap=cm.bone,extent=(0,1,0,1))
> colorbar('%1.1e',cax=a2)
>
> show()
>
> I am getting the jet colormap in the colorbar, is it possible to change it
> manually?
I found a workaround (or a work-a-right).
a1.imshow(z,cmap=cm.bone,extent=(0,1,0,1))
does not define a mappable image that colorbar can locate. This will work:
axes(a1)
imshow(z,cmap=cm.bone,extent=(0,1,0,1)).
Darren
|