On 2014/03/02 1:02 AM, ChaoYue wrote: > Dear Eric, > > This solved part of my problem. thanks a lot. > I think I will revisit this issue when I have time (not promised). > do you think this could be some feature desirable?
I don't understand what feature you are referring to; evidently I don't understand what the problem is, so I don't know what part remains unsolved. Eric > > Cheers, > > Chao > > > On Sat, Mar 1, 2014 at 10:39 PM, Eric Firing [via matplotlib] <[hidden > email] </user/SendEmail.jtp?type=node&node=42956&i=0>> wrote: > > On 2014/03/01 11:03 AM, ChaoYue wrote: > > The most correct way might be to design a new colormap with white > color > > exactly in the middle, however this is very tedious, especially if I > > want to try > > different colormaps. so the alternative approach would be to set > the values > > falling in (-1,1) as being masked, so they will be the same as > the axes > > background color as you mentioned (in our case it's white). My > question is, > > how can I put this background color (which shows maksed data) in the > > colorbar, > > by avoiding design a new colormap? > > It's not the answer you want to hear, but I think the correct answer is > that you should do this via the colormap, and not by masking the low > values. It doesn't have to be painful. If, in contourf, you use a > diverging colormap with white already in the middle > (http://matplotlib.org/examples/color/colormaps_reference.html) and a > norm with symmetric limits (vmin and vmax; you can let them be set > automatically after you specify your symmetric set of contour > boundaries > appropriately) then it will be done for you. > > e.g., > > z = 10 * np.random.randn(20, 30) > clevs = [-10, -5, -2, -1, 1, 2, 5, 10] > cs = plt.contourf(z, levels=clevs, cmap=plt.get_cmap('PRGn'), > extend='both') > cbar = plt.colorbar(cs, spacing='uniform') > > Eric > > > ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Flow-based real-time traffic analytics software. Cisco certified tool. Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer Customize your own dashboards, set traffic alerts and generate reports. Network behavioral analysis & security monitoring. All-in-one tool. http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users