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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 337 - (show annotations)
Mon Dec 12 01:57:07 2005 UTC (13 years, 9 months ago) by cochrane
File MIME type: text/x-python
File size: 1473 byte(s)
Initial merge of pyvisi into esys repository.
1 # $Id: multiCurvePlotExample.py,v 1.19 2005/05/24 01:36:25 paultcochrane Exp $
2
3 """
4 Example of plotting multiple curves with pyvisi
5 """
6
7 # set up some data to plot
8 from Numeric import *
9
10 x = arange(0, 2*pi, 0.1, typecode=Float)
11 y1 = sin(x)
12 y2 = cos(x)
13 y3 = cos(x)**2
14
15 # example code for how a user would write a script in pyvisi
16 from pyvisi import * # base level visualisation stuff
17 # import the objects to render the scene using the specific renderer
18 from pyvisi.renderers.gnuplot import * # gnuplot
19 #from pyvisi.renderers.vtk import * # vtk
20 #from pyvisi.renderers.plplot import * # plplot
21
22 # define the scene object
23 # a Scene is a container for all of the kinds of things you want to put
24 # into your plot for instance, images, meshes, arrow/vector/quiver plots,
25 # contour plots, spheres etc.
26 scene = Scene()
27
28 # create a LinePlot object
29 plot = LinePlot(scene)
30
31 # add some helpful info to the plot
32 plot.title = 'Example 2D plot'
33 plot.xlabel = 'x'
34 plot.ylabel = 'y'
35
36 plot.linestyle = 'lines'
37
38 # assign some data to the plot
39 plot.setData(x, y1, y2, y3)
40
41 # render the scene to screen
42 scene.render(pause=True,interactive=True)
43
44 # save the scene to file
45 plot.setData(x, y1, y2, y3) # have to do this now because we've already
46 # render()ed the scene. This requirement
47 # will be removed in the future.
48 scene.save(fname="multiCurveLinePlot.png", format=PngImage())
49
50 # vim: expandtab shiftwidth=4:
51

  ViewVC Help
Powered by ViewVC 1.1.26