From: David H. <dav...@gm...> - 2007-02-07 14:16:05
|
You can also take a look at the wiki http://www.scipy.org/Cookbook/Matplotlib/ColormapTransformations There you'll find the code I had about colormap discretization. Maybe it does the same thing Eric discussed, however. Cheers, David 2007/2/6, Eric Firing <ef...@ha...>: > > Claas Teichmann wrote: > > Hi David and Eric, > > > > one year ago, you discussed a discretazation of the colorbar with > > imshow() in matplotlib-users. The topic was "DIscretization of > > colorbar". Did you succeed in using a discrete colorbar? > > Yes, I completely rewrote the colorbar code, and it is now quite flexible. > > > > > I put a request to the mailinglist with the topic "Wrong > > colorbar-ticks in imshow-colorbar with 10 colors". Maybe one of you > > already got the answer? > > > > Many greetings! > > > > Claas :-) > > Assuming you have a reasonably recent version of mpl, you can modify > your colorbar call this way: > > colorbar(ticks=linspace(im.norm.vmin, im.norm.vmax, 11)) > > (This is for your example with a 10-entry colormap.) > > Because of a default parameter that is not exposed, it will label only > every second color boundary in the example from your earlier message. > To make it label every boundary, you could use > > from matplotlib import ticker > ticks = linspace(im.norm.vmin, im.norm.vmax, 11) > tickmaker = ticker.FixedLocator(ticks, nbins=20) > # make nbins >= number of ticks > colorbar(ticks=tickmaker) > > Eric > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |