On Thu, Sep 22, 2011 at 2:31 PM, Andreas Matthias <
andreas.matth...@gmail.com> wrote:

> I would like to plot a masked array with plot_surface().
> But unlike imshow() which really plots the masked data,
> plot_surface() only plots the non-masked data.
>
> How can I plot the masked array?
>
> Ciao
> Andreas
>
>
>
> import numpy as np
> import pylab as mpl
> from mpl_toolkits.mplot3d import axes3d
>
> x = np.arange(1,10,1)
> y = np.arange(1,10,1)
> x,y = np.meshgrid(x,y)
> z = x**3 + y**3 - 500
> z = np.ma.masked_array(z, z<0)
>
> cm = mpl.cm.jet
>
> ax1 = mpl.subplot(1,2,1, projection='3d')
> ax1.plot_surface(x,y,z,
>                 rstride=1, cstride=1, linewidth=0,
>                 cmap=cm)
>
> ax2 = mpl.subplot(1,2,2)
> ax2.imshow(z, cmap=cm)
>
> mpl.show()
>
>
Andreas,

I once had a patch I made for someone else with this request, but it broke a
bunch of things for regular uses of plot_surface, so I never added it.  I
will see if I can dig it up for you as a work-around.

In the meantime, could you file a feature request for this in the github
tracker, please?

Ben Root
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to