On Fri, Sep 4, 2009 at 10:11 AM, Westly Ward<sonicrules1...@gmail.com> wrote:
> Hi. I need some help creating a 3d wireframe in matplotlib in python. Here
> is my code.
>
> Code:
> from __future__ import division
> import matplotlib.pyplot as plt
> from numpy import *
>
> fig = plt.figure()
> from mpl_toolkits.mplot3d import Axes3D
> ax = Axes3D(fig)
> xlist = []
> ylist = []
> zlist = []
> for x in range(1, 100) :
>    for y in range(1, 100) :
>        xlist.append(x)
>        ylist.append(y)
>        zlist.append(x/y)
> numpyx = array(xlist)
> numpyy = array(ylist)
> numpyz = array(zlist)
> ax.plot_wireframe(numpyx, numpyy, numpyz)
> ax.set_xlabel('X Label')
> ax.set_ylabel('Y Label')
> ax.set_zlabel('Z Label')
> plt.show()
>
>
> Traceback (most recent call last):
>  File "C:\Users\Westly\Desktop\3dimage.py", line 19, in <module>
>    ax.plot_wireframe(numpyx, numpyy, numpyz)
>  File "C:\Python25\Lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line
> 684, in plot_wireframe
>    rows, cols = Z.shape
> ValueError: need more than 1 value to unpack
>
> How exactly do I give it my arrays?
> Thanks in advance for any help.
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

how about:

from __future__ import division
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
from mpl_toolkits.mplot3d import Axes3D
ax = Axes3D(fig)

ys, xs = np.mgrid[1:100, 1:100]

ax.plot_wireframe(xs, ys, xs/ys)
plt.show()

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to