On Monday, November 19, 2012 13:53:21 Eric Firing wrote:

> It is not entirely clear to me what you are trying to do, but it sounds
> like increasing N is not the right way to do it. Three things might help
> you find a better way:
> 
> 1) The colormap is intended to work with a norm that handles the
> translation from your data numbers to the 0-1.0 range used to select
> values from the colormap (with exceptions--see below).  You can choose a
> non-default norm, you can write your own, or you can set the parameters
> (vmin, vmax) of the standard linear norm.
> 
> 2) By creating a colormap and calling its set_under, set_over, and
> set_invalid methods, you can control the colors assigned to data values
> that your norm maps respectively to negative numbers, numbers greater
> than 1, and masked values.  See
> http://matplotlib.org/examples/pylab_examples/contourf_demo.html for an
> example of using set_under and set_over.  See
> http://matplotlib.org/examples/pylab_examples/image_masked.html for
> another example, and for an example of controlling the norm parameters
> or using an alternative norm.
> 
> 3) It is also possible to index directly into the colormap if you use a
> norm that returns an integer data type.  An example of such is the
> BoundaryNorm.
> http://matplotlib.org/examples/pylab_examples/multicolored_line.html
> 
> If all you need is a single assignment of a color to a "large value",
> then using the set_over method will take care of it.
> 
> Eric

Thanks for your answer.

My goal is to keep the correct color, i.e. blue, for the point located at 
(x=0.3, y=0.4), even if there are very large values of z on the plot. As I 
said, increasing N is not satisfying because it leads to large amounts of 
memory to be used. But for the time being, this is the only solution I have 
found.

I cannot use the set_over method to do that, because the "large  value" is not 
the only one. Indeed, what I want to do is an imshow plot, with a colorbar 
containing three different linear portions:
* one portion for the values of z contained between the minimum and maximum 
value of z in some measure points.
* one portion for the values of z below the minimum z in the measure points.
* one portion for the values of z above the maximum z in the measure points.

My problem is that I may have very large values on the plot in the range below 
or above the measures z. So I have exactly the problem shown in my dummy 
example of the previous post: all my measures have the same color, although 
they should not, because I have created a colormap that should handle this 
situation (three different linear portions in the map). The only workaround I 
have found is to increase the value of N, but in my case it has to be very 
large, such that the plot is very slow to display, or even can ask for huge 
amounts of memory.

Thus it seems to me that my dummy example given in the previous post covers 
exactly the problem encountered in my real-world imshow function.

Is there a memory-efficient workaround in my dummy example (instead of 
increasing N)?

Thanks,

TP

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to