Maybe I understand what he means. How can a user override some value in a
colormap? Lets say, in general user wants to inherit some ready made colormap
but in addition wants to force certain colors to some data items.
M.
Eric Firing wrote:
> 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] > 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
>
--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries. Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users