From: Benjamin R. <ben...@ou...> - 2011-11-23 17:06:12
|
On Wednesday, November 23, 2011, Bala subramanian <bal...@gm...> wrote: > Hello, > I am trying to make a wireframe plot with the x,y,z values in my data (attached file). I get the following error which i dnt understand. Kindly write me what is going wrong. > > Traceback (most recent call last): > File "test.py", line 14, in <module> > ax.plot_wireframe(d1,d2,d3) > File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.py", line 687, in plot_wireframe > rows, cols = Z.shape > ValueError: need more than 1 value to unpack > > I used is similar code as in the gallery. > > #!/usr/bin/env python > import numpy as np > from mpl_toolkits.mplot3d import Axes3D > import matplotlib.pyplot as plt > > d1=np.loadtxt('test.dat',usecols=(0,)) > d2=np.loadtxt('test.dat',usecols=(1,)) > d3=np.loadtxt('test.dat',usecols=(2,)) > > fig=plt.figure() > ax = Axes3D(fig) > > ax.plot_wireframe(d1,d2,d3) > > Thanks, > Bala > > The data needs to be 2d. I think the x and y can be 1d, so long as they can be broadcasted together to the same shape as Z. Ben Root |