Jeremy,

The pcolor function can take a vmin and a vmax parameter if you wish to
control the colorscaling.  In addition, you can use a special array
structure called a "masked array" to have pcolor ignore "special" values.
Assuming your data is 'vals':

vals_masked = numpy.ma.masked_array(vals, vals == 0.0)

Note that depending on your situation, doing an equality with with a
floating point  value probably isn't very reliable, so be sure to test and
modify to suit your needs.  'vals_masked' can then be passed to pcolor
instead of vals.

I hope this helps,
Ben Root

On Wed, Jun 30, 2010 at 9:39 AM, Jeremy Conlin <jlcon...@gmail.com> wrote:

> I am trying to plot some data over  a mesh using the plot_surface
> method.  However when I plot my data, everything is the same color
> when I expected to get a nice rainbow of colors as in the example:
> http://matplotlib.sourceforge.net/examples/mplot3d/surface3d_demo.html
>
> I have attached a simple script to show what I did as well as the
> result.  Essentially, I just copied the above demo, but put my own
> data in.  I think the problem arises because I have "holes" in my
> data, or areas where the data is zero.  These zeros throw the scaling
> off so I tried to eliminate their effect, but this messed everything
> up.
>
> Essentially my question is: how can I get a nice color distribution
> while at the same time avoid the extreme scaling issues associated
> with some data being zero (while all the other data is ~16)?
>
> Thanks,
> Jeremy
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to