Michael Outhouse wrote:
> I was wondering if it is possible to change the colorbar tick labeling in
> matplotlib from numeric to text. Essentially, I want the colorbar to be a
> qualitative indicator; in the jet scheme, I'd like blue to be labeled
> as 'unstable', green as 'neutral', and red as 'stable'. I can change it so I
> just show the underlying values - colorbar(ticks = (-1, 0, 1)), but I cannot
> change the the tick labels to text. Is there any way to accomplish this?
> Thanks in advance for any help.
Your message came more than a month ago, but it looks like no one
answered, so here is an answer:
with ipython -pylab:
imshow(2*rand(10,10) - 1, vmin=-1, vmax=1)
cbar = colorbar(ticks=[-1,0,1])
cbar.ax.set_yticklabels(['unstable', 'neutral', 'stable'])
draw()
|