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

Contents of /trunk/pyvisi/examples/multiCurveLinePlot.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 605 - (show annotations)
Mon Mar 20 07:16:27 2006 UTC (13 years, 7 months ago) by gross
File MIME type: text/x-python
File size: 1526 byte(s)
pyvisi with vtk runs noe on the altix
1 # $Id: multiCurveLinePlot.py,v 1.3 2005/11/08 08:23:45 paultcochrane Exp $
2
3 """
4 Example of plotting multiple curves 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 x = arange(0, 2*pi, 0.1, typecode=Float)
18 y1 = sin(x)
19 y2 = cos(x)
20 y3 = cos(x)**2
21
22 # example code for how a user would write a script in pyvisi
23 from esys.pyvisi import * # base level visualisation stuff
24 # import the objects to render the scene using the specific renderer
25 if ren_mod == "gnuplot":
26 from esys.pyvisi.renderers.gnuplot import * # gnuplot
27 elif ren_mod == "vtk":
28 from esys.pyvisi.renderers.vtk import * # vtk
29 elif ren_mod == "plplot":
30 from esys.pyvisi.renderers.plplot import * # plplot
31 else:
32 raise ValueError, "Unknown renderer module"
33
34 # define the scene object
35 # a Scene is a container for all of the kinds of things you want to put
36 # into your plot for instance, images, meshes, arrow/vector/quiver plots,
37 # contour plots, spheres etc.
38 scene = Scene()
39
40 # create a LinePlot object
41 plot = LinePlot(scene)
42
43 # add some helpful info to the plot
44 plot.title = 'Example 2D plot'
45 plot.xlabel = 'x'
46 plot.ylabel = 'y'
47
48 plot.linestyle = 'lines'
49
50 # assign some data to the plot
51 plot.setData(x, y1, y2, y3)
52
53 # render the scene to screen
54 scene.render(pause=True,interactive=True)
55
56 # save the scene to file
57 scene.save(fname="multiCurveLinePlot.png", format=PngImage())
58
59 # vim: expandtab shiftwidth=4:
60

  ViewVC Help
Powered by ViewVC 1.1.26