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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 786 - (show annotations)
Tue Jul 25 04:58:05 2006 UTC (13 years, 3 months ago) by gross
File MIME type: text/x-python
File size: 2101 byte(s)
switched off pyvisi
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 @var __author__: name of author
7 @var __license__: licence agreement
8 @var __copyright__: copyrights
9 @var __url__: url entry point on documentation
10 @var __version__: version
11 @var __date__: date of the version
12 """
13
14 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
15 http://www.access.edu.au
16 Primary Business: Queensland, Australia"""
17 __license__="""Licensed under the Open Software License version 3.0
18 http://www.opensource.org/licenses/osl-3.0.php"""
19 __author__="Paul Cochrane"
20 __url__="http://www.iservo.edu.au/esys"
21 __version__="$Revision$"
22 __date__="$Date$"
23
24
25 # set up some data to plot
26 from Numeric import *
27
28 x = arange(0, 2*pi, 0.1, typecode=Float)
29 y1 = sin(x)
30 y2 = cos(x)
31 y3 = cos(x)**2
32
33 # example code for how a user would write a script in pyvisi
34 from esys.pyvisi import * # base level visualisation stuff
35 # import the objects to render the scene using the specific renderer
36 from esys.pyvisi.renderers.gnuplot import * # gnuplot
37 #from esys.pyvisi.renderers.vtk import * # vtk
38 #from esys.pyvisi.renderers.plplot import * # plplot
39
40 # define the scene object
41 # a Scene is a container for all of the kinds of things you want to put
42 # into your plot for instance, images, meshes, arrow/vector/quiver plots,
43 # contour plots, spheres etc.
44 scene = Scene()
45
46 # create a LinePlot object
47 plot = LinePlot(scene)
48
49 # add some helpful info to the plot
50 plot.title = 'Example 2D plot'
51 plot.xlabel = 'x'
52 plot.ylabel = 'y'
53
54 plot.linestyle = 'lines'
55
56 # assign some data to the plot
57 plot.setData(x, y1, y2, y3)
58
59 # render the scene to screen
60 scene.render(pause=True,interactive=True)
61
62 # save the scene to file
63 plot.setData(x, y1, y2, y3) # have to do this now because we've already
64 # render()ed the scene. This requirement
65 # will be removed in the future.
66 scene.save(fname="multiCurveLinePlot.png", format=PngImage())
67
68 # vim: expandtab shiftwidth=4:
69

  ViewVC Help
Powered by ViewVC 1.1.26