John and others developers, I think the current colorbar implementation has some (minor) issue related with how ticks are treated.
Here is a quick example, imshow(np.arange(100).reshape((10,10))) cb = colorbar() This gives you a nice colorbar, However, an issue arises when you want to change the ticks. cax = cb.ax cax.set_yticks([0, 40, 80]) And the colorbar got messed up. Changing ticks and ticklabels after the colobar is created is quite tricky. And, the easiest solution is to set those when creating the colorbar. As far as I can see, the real confusion comes fromthe fact that, in the current colorbar implementation, the data coordinate of the colorbar axes has nothing to do with the actual color scale. In the above example, while the color scale ranges from 0 to 99, the data coordinate (ylim) is still from 0 to 1. A few months back, I worked on a revised implementation of the colorbar, and that version of colorbar is currently included in the axes_grid toolkit. It is backward-compatible, but it uses "axes_locator" feature that I'm a bit reluctant to push into the mainline matplotlib. So, here is a few possible resolutions I consider. 1) leave it as is. but issue a warning when a users calls "set_yticks" (or its relatives) on the colobar axes. 2) use the reimplemented version of the colorbar, but drop the axes_locator part. The colorbar will be fully functional except the "extend" feature (triangles at the ends of the colorbar. see http://matplotlib.sourceforge.net/examples/api/colorbar_only.html). 3) use the reimplemented version of the colorbar. 4) someone else comes up with a better implementation. I don't think there is an immediate need for any changes as I see it as a minor issue. I'm just posting this as there has been a few recent questions regarding the colorbar behavior in the user list. Any suggestion and/or comments? Regards, -JJ ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel