# [SciPy-User] creating a 3D surface plot from collected data

alexander baker baker.alexander@gmail....
Mon Feb 15 10:47:18 CST 2010

```Example here that might help.

Regards

Alex Baker

http://www.alexfb.com/cgi-bin/twiki/view/PtPhysics/Spherical-Polar-Coordinates-Python

Mobile: 07788 872118
Blog: www.alexfb.com

--
All science is either physics or stamp collecting.

On 15 February 2010 14:17, URI <zallen@urologicresearchinstitute.org> wrote:

> I am trying to figure out how to create a 3D surface plot from some x,y,z
> data
> that I have.  I don't have any particular preference as to how to do it,
> but
> from poking around on the web it seems like mplot3d should be able to do
> it,
> based on what I see in the tutorial (look at the wireframe or surface plot
> sections):
>
> http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html
>
> The problem I have is that none of the example source code is based on
> working
> with numbers from actual data.  The only thing I could find that addresses
> this
> Example":
> http://www.scipy.org/Cookbook/Matplotlib/mplot3D
>
> I've tried to duplicate this method but I get errors, and I don't really
> understand it anyway.  The place I get lost is here:
>
> Z = numpy.zeros((len(Y), len(X)), 'Float32')
> for d in data:
>   x, y, z = d
>   ix = int(x * 10)
>   iy = int(y * 10)
>   Z[iy, ix] = z
>
>
> I don't understand how ix and iy are supposed to give me valid indeces for
> the Z
> array (and Python doesn't seem to understand it either, it gives me an
> error at
> that last line).
>
> Can someone either explain this method to me, or point me in a different
> direction?
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100215/ca47efe8/attachment.html
```