hi all
I have a little script who just plot some tripet (random triplet) but I have a index out of bound
What I don’t understand is if Xl is diff of Yl , I have that error
Traceback (most recent call last):
File “test_plot3D.py”, line 26, in
ax.plot_wireframe(X, Y, Z)
File “/usr/lib/python2.5/site-packages/matplotlib/axes3d.py”, line 562, in plot_wireframe
txlines = [tX[i] for i in cii]
IndexError: index out of bounds
if there equals, all is perfect, but I haven’t that.
there is the script
import numpy
import pylab as p
import matplotlib.axes3d as p3
import random
data = []
Xl = 10
Yl = 40 #if Yl = Xl , all is ok
#create data
for i in range(Xl):
for j in range(Yl):
data.append( (i,j,int( random.random()*10 ) ) )
X, Y = numpy.meshgrid(p.arange(0, Xl, 1), p.arange(0, Yl, 1))
Z = numpy.zeros( (Xl, Yl) )
for d in data:
x, y, z = d
Z[x, y] = z
fig = p.figure()
ax = p3.Axes3D(fig)
ax.plot_wireframe(X, Y, Z)
p.show()
any help.
thanks.
a++