/[escript]/trunk/pyvisi/examples/isosurfacePlot.py
ViewVC logotype

Annotation of /trunk/pyvisi/examples/isosurfacePlot.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 337 - (hide annotations)
Mon Dec 12 01:57:07 2005 UTC (14 years, 6 months ago) by cochrane
File MIME type: text/x-python
File size: 1339 byte(s)
Initial merge of pyvisi into esys repository.
1 cochrane 337 # $Id: isosurfacePlot.py,v 1.4 2005/11/08 08:23:45 paultcochrane Exp $
2    
3     """
4     Example of plotting a set of isosurfaces with pyvisi
5     """
6    
7     import sys
8     numArgs = len(sys.argv)
9     if numArgs == 1:
10     ren_mod = "vtk"
11     else:
12     ren_mod = sys.argv[1]
13    
14     # set up some data to plot
15     from Numeric import *
16    
17     # example code for how a user would write a script in pyvisi
18     from pyvisi import * # base level visualisation stuff
19     # import the objects to render the scene using the specific renderer
20     if ren_mod == "vtk":
21     from pyvisi.renderers.vtk import * # vtk
22     elif ren_mod == "povray":
23     from pyvisi.renderers.povray import * # povray
24     else:
25     raise ValueError, "Unknown renderer module"
26    
27     # define the scene object
28     # a Scene is a container for all of the kinds of things you want to put
29     # into your plot for instance, images, meshes, arrow/vector/quiver plots,
30     # contour plots, spheres etc.
31     scene = Scene()
32    
33     # create a IsosurfacePlot object
34     plot = IsosurfacePlot(scene)
35    
36     # add some helpful info to the plot
37     plot.title = 'Example isosurface plot'
38     plot.xlabel = 'x'
39     plot.ylabel = 'y'
40     plot.zlabel = 'z'
41    
42     # plot data defined in a vtk file
43     plot.setData(fname='temp-0500.vtk', format='vtk-xml')
44    
45     scene.render(pause=True, interactive=True)
46    
47     # save the plot
48     scene.save(fname="isosurfacePlot.png", format="png")
49    
50     # vim: expandtab shiftwidth=4:
51    

  ViewVC Help
Powered by ViewVC 1.1.26