On Tue, Dec 11, 2012 at 8:25 AM, Degang Wu <samuelan...@gmail.com> wrote:

> Hi,
>
> My OS is Mac OS X Lion, and the version of matplotlib is 1.2.0 from
> macport.
>
> Now I have an 2d array
>
> a=array([[   0.        ,    0.        ,    0.        ,    0.        ,
>            0.        ,    0.        ,    0.        ,    0.        ,
>            0.        ,    0.        ,    0.        ,    0.        ],
>        [   0.        ,    0.        ,    0.        ,    0.        ,
>            0.        ,    0.        ,    0.        ,    0.        ,
>            0.        ,    0.        ,    0.        ,    0.        ],
>        [   0.        ,    0.        ,    0.        ,    0.        ,
>            0.        ,    0.        ,    0.        ,    0.        ,
>            0.        ,    0.        ,    0.        ,    0.        ],
>        [   0.        ,    0.        ,    0.        ,    0.        ,
>            0.        ,    0.        ,    0.        ,    0.        ,
>            0.        ,    0.        ,    0.        ,    0.        ],
>        [   0.        ,    0.        ,    0.        ,    0.        ,
>            0.        ,    6.40312424,   19.02629759,    9.8488578 ,
>           12.16552506,   14.        ,    0.        ,   37.01351105],
>        [   0.        ,    0.        ,    0.        ,    0.        ,
>            6.40312424,    4.24264069,    1.41421356,    8.54400375,
>            4.47213595,   31.25699922,    0.        ,   25.70992026],
>        [   0.        ,    0.        ,    0.        ,    0.        ,
>           19.02629759,    1.41421356,   17.2626765 ,   31.32091953,
>           24.18677324,   43.829214  ,    0.        ,   55.14526272],
>        [   0.        ,    0.        ,    0.        ,    0.        ,
>            9.8488578 ,    8.54400375,   31.32091953,   35.51056181,
>           40.81666326,   57.27128425,    0.        ,   84.62860037],
>        [   0.        ,    0.        ,    0.        ,    0.        ,
>           12.16552506,    4.47213595,   24.18677324,   40.81666326,
>           43.65775991,   74.24957912,    0.        ,  112.0044642 ],
>        [   0.        ,    0.        ,    0.        ,    0.        ,
>           14.        ,   31.25699922,   43.829214  ,   57.27128425,
>           74.24957912,    0.        ,    0.        ,    0.        ],
>        [   0.        ,    0.        ,    0.        ,    0.        ,
>            0.        ,    0.        ,    0.        ,    0.        ,
>            0.        ,    0.        ,    0.        ,    0.        ],
>        [   0.        ,    0.        ,    0.        ,    0.        ,
>           37.01351105,   25.70992026,   55.14526272,   84.62860037,
>          112.0044642 ,    0.        ,    0.        ,    0.        ]])
>
> first I plot it (in ipython notebook) using:
>
> coord_max=12
> fig = plt.figure()
> ax = fig.gca(projection='3d')
> x,y=np.meshgrid(np.arange(coord_max),np.arange(coord_max))
> ax.plot_wireframe(x,y,a)
>
> and the plot looks fine.
>
> but if I use plot_surface instead, the plot looks very wrong: the plot is
> zero everywhere except on the boundaries.
>

This is because the default rstride and cstride arguments is 10, IIRC.
Since your array is only 12x12, the surface plotting is barely plotting
anything.  Try calling:

ax.plot_surface(x, y, a, rstride=1, cstride=1)

I hope that helps!
Ben Root
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to