On 2012/07/09 7:33 AM, Brendan Barnwell wrote:
> On 2012-07-09 06:13, Benjamin Root wrote:
>> On Sun, Jul 8, 2012 at 9:04 PM, Brendan Barnwell<brenb...@brenbarn.net>wrote:
>>>   cs = pyplot.contourf(x,y,z,levels=np.arange(50, 220, 20),
>>>   cmap=pyplot.cm.jet, extend='both')
>>>   cs.cmap.set_under('k')
>>>   cs.set_clim(50, 210)
>>>   cb = pyplot.colorbar(cs)
>>>
>>>           But why do I have to do this?  The whole reason I passed in my
>>>   specified levels was because I wanted THOSE to be the data limits.
>>>   Why is matplotlib expanding the data limits, and thus preventing me
>>>   from specifying the "out of range" color using the normal set_under
>>>   and set_over methods?
>>>
>>>
>> You are right, that behavior is very inconsistent with the documentation.
>> Looking over the QuadContourSet._process_levels() method, I doubt the
>> problem lies there.  While testing, I noticed that whatever color I set for
>> set_under() was always being ignored in the colorbar.  I suspect the
>> problem lies there.
>
>       You mean in the colorbar and/or set_under?  I don't think so, because
> the problem occurs whether or not you use a colorbar, and, at least
> for me, set_under works as long as the data limits are set correctly.
>    If in my code above, I change set_under("k") to set_under("yellow")
> or whatever else I like, that color is correctly used both in the
> contourf plot and on the colorbar (on the lower arrow).  The code that
> I pointed to in _process_levels is setting vmin and vmax.  It's
> possible this isn't the root of the problem, but the code certainly
> looks strange and unmotivated, and it is what's causing incorrect clim
> to be set.
>

Please check out https://github.com/matplotlib/matplotlib/pull/1022.

Eric


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to