/[escript]/trunk/pyvisi_old/examples/contourPlotExample.py
ViewVC logotype

Diff of /trunk/pyvisi_old/examples/contourPlotExample.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 819 by gross, Tue Jul 25 04:58:05 2006 UTC revision 820 by gross, Mon Aug 28 06:55:36 2006 UTC
# Line 23  __date__="$Date$" Line 23  __date__="$Date$"
23    
24    
25  # what plotting method are we using?  # what plotting method are we using?
26  method = 'pyvisi'  method = 'vtk'
27    
28  # set up some data to plot  # set up some data to plot
29  from Numeric import *  # from Numeric import *
30    from numarray import *
31    
32  # the x and y axes  # the x and y axes
33  x = arange(-2,2,0.2, typecode=Float)  # x = arange(-2,2,0.2, typecode=Float)
34  y = arange(-2,3,0.2, typecode=Float)  # y = arange(-2,3,0.2, typecode=Float)
35    
36    x = arange(-2,2,0.2, type=Float)
37    y = arange(-2,3,0.2, type=Float)
38    
39  # pick some interesting function to generate the data in the third dimension  # pick some interesting function to generate the data in the third dimension
40  # this is the one used in the matlab docs: z = x*exp(-x^2-y^2)  # this is the one used in the matlab docs: z = x*exp(-x^2-y^2)
41  z = zeros((len(x),len(y)), typecode=Float)  # z = zeros((len(x),len(y)), typecode=Float)
42    z = zeros((len(x),len(y)), type=Float)
43    
44  # boy do *I* feel old fashioned writing it this way  # boy do *I* feel old fashioned writing it this way
45  # surely there's another way to do it: - something to do later  # surely there's another way to do it: - something to do later
# Line 99  elif method == 'vtk': Line 104  elif method == 'vtk':
104              _points.InsertPoint(_index, x[_i], y[_j], 0)              _points.InsertPoint(_index, x[_i], y[_j], 0)
105              _scalars.InsertValue(_index, z[_i,_j])              _scalars.InsertValue(_index, z[_i,_j])
106    
107      zMin = min(min(z))      zMin = minval(minval(z))
108      zMax = max(max(z))      zMax = maxval(maxval(z))
109    
110      _data = vtk.vtkUnstructuredGrid()      _data = vtk.vtkUnstructuredGrid()
111      _data.SetPoints(_points)      _data.SetPoints(_points)

Legend:
Removed from v.819  
changed lines
  Added in v.820

  ViewVC Help
Powered by ViewVC 1.1.26