From: Mark Bakker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 05, 2008 06:25
Hello list -
I am trying to change the yticks on my colorbar (in combination with contourf)
and cannot figure
out how to do it.
Short example:
x,y = meshgrid(linspace(0,10),linspace(0,10))
a = contourf(x,y,x,linspace(0,10,6))
b = colorbar(a)
This gives a nice colorbar, with ticks at 0,2,4,6,8,10
But I want labels only at 0,5,10. So I thought I can change that as:
b.ax.set_yticks([0,5,10])
draw()
But this gives really wacky results (totally messes up the colorbar), so that
doesn't seem to be
the way to do it.
Can anybody tell me the correct way to do it?
Thanks, Mark
Try
b = colorbar(a, ticks=linspace(0, 10, 3))
Documentation is at
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.colorbar.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users