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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 786 - (show annotations)
Tue Jul 25 04:58:05 2006 UTC (13 years, 2 months ago) by gross
File MIME type: text/x-python
File size: 2006 byte(s)
switched off pyvisi
1 # $Id: simplePlotExample.py,v 1.9 2005/05/24 01:42:44 paultcochrane Exp $
2
3 """
4 Example of plotting lines 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(10, typecode=Float)
29 y = x**2
30
31 # example code for how a user would write a script in pyvisi
32 from esys.pyvisi import * # base level visualisation stuff
33 # import the objects to render the scene using the specific renderer
34 #from esys.pyvisi.renderers.gnuplot import * # gnuplot
35 from esys.pyvisi.renderers.vtk import * # vtk
36 #from esys.pyvisi.renderers.plplot import * # plplot
37
38 # define the scene object
39 # a Scene is a container for all of the kinds of things you want to put
40 # into your plot for instance, images, meshes, arrow/vector/quiver plots,
41 # contour plots, spheres etc.
42 scene = Scene()
43
44 # create a LinePlot object
45 plot = LinePlot(scene)
46
47 # add some helpful info to the plot
48 plot.title = 'Example 2D line plot'
49 plot.xlabel = 'x'
50 plot.ylabel = 'x^2'
51
52 plot.linestyle = 'lines'
53
54 # assign some data to the plot
55 plot.setData(x, y)
56
57 # render the scene to screen
58 scene.render(pause=True, interactive=True)
59
60 # save the scene out to file
61 ## png
62 plot.setData(x, y) # have to do this now because we've already
63 # render()ed the scene, will be removed in the
64 # future
65 scene.save(fname="simpleLinePlot.png", format=PngImage())
66
67 # vim: expandtab shiftwidth=4:
68

  ViewVC Help
Powered by ViewVC 1.1.26