[vtkusers] 3D scatter plot

G P telos888 at yahoo.com
Wed Apr 6 21:25:11 EDT 2005


Greetings,

I am trying to plot a data set of about 200,000 x, y,
z points with MayaVi and VTK, the Python program I put
together works fine for small groups of numbers, but
anything over say 10,000 I get the following message
when I try to render the array with VTK:

----------
Scalars.__init__._get_name.warning:
        Using name='Scalars0'
Scalars.__init__._get_lookup_table.warning:
        Using lookup_table='default'
Traceback (most recent call last):
  File "./testpoints.py", line 35, in ?
    vt.tofile('xyz.vtk')
  File
"/usr/lib/python2.3/site-packages/pyvtk/__init__.py",
line 195, in tofile
    f.write(self.to_string(format))
  File
"/usr/lib/python2.3/site-packages/pyvtk/__init__.py",
line 169, in to_string
    ret = ['# vtk DataFile Version 2.0',
  File
"/usr/lib/python2.3/site-packages/pyvtk/UnstructuredGrid.py",
line 87, in to_string
    t = self.get_datatype(self.points)
  File
"/usr/lib/python2.3/site-packages/pyvtk/common.py",
line 125, in get_datatype
    r = self.get_datatype(o)
  File
"/usr/lib/python2.3/site-packages/pyvtk/common.py",
line 125, in get_datatype
    r = self.get_datatype(o)
  File
"/usr/lib/python2.3/site-packages/pyvtk/common.py",
line 120, in get_datatype
    raise ValueError,'expected int|float|non-empty
sequence but got %s'%t
ValueError: expected int|float|non-empty sequence but
got <type 'long'>
----------

Here is an example set of coordinates that are in x,
y, and z:

----------
-41374 -53971 -44975
-59587 -56972 -41923
-57626 -57237 -45579
-34283 -35894 -37457
-33144 -57130 -52502
-64898 -56998 -44598
-71716 -62588 -59465
-55663 -65333 -50883
-37412 -65414 -33598
-51713 -40285 -53948
-33686 -54479 -59341
-63665 -36130 -64861
-59285 -36807 -45051
-40494 -38004 -47581
-61516 -48195 -48235
-38270 -57041 -46794
-47016 -33707 -61578
-50955 -45559 -64038
----------

And here is the transpose function from Numeric that
puts everything into an array called 'nodes':

----------
nodes = transpose([x]+[y]+[z])
vt = VtkData(UnstructuredGrid(nodes,
vertex=range(len(x))), PointData(Scalars(z)), 'Point
Cloud')
vt.tofile('xyz.vtk')
----------

Any ideas?  Where am I screwing up here?

Thanks in advance

Greg





More information about the vtkusers mailing list