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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 605 - (hide annotations)
Mon Mar 20 07:16:27 2006 UTC (14 years, 3 months ago) by gross
File MIME type: text/x-python
File size: 1440 byte(s)
pyvisi with vtk runs noe on the altix
1 cochrane 337 # $Id: singleArrayPlotExample.py,v 1.12 2005/05/24 01:44:15 paultcochrane Exp $
2    
3     """
4     Example of plotting a curve using only one input array 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     y = sin(x)
12    
13     # example code for how a user would write a script in pyvisi
14 gross 605 from esys.pyvisi import * # base level visualisation stuff
15 cochrane 337 # import the objects to render the scene using the specific renderer
16 gross 605 from esys.pyvisi.renderers.gnuplot import * # gnuplot
17     #from esys.pyvisi.renderers.vtk import * # vtk
18     #from esys.pyvisi.renderers.plplot import * # plplot
19 cochrane 337
20     # define the scene object
21     # a Scene is a container for all of the kinds of things you want to put
22     # into your plot for instance, images, meshes, arrow/vector/quiver plots,
23     # contour plots, spheres etc.
24     scene = Scene()
25    
26     # create a LinePlot object
27     plot = LinePlot(scene)
28    
29     # add some helpful info to the plot
30     plot.title = 'Example 2D plot'
31     plot.xlabel = 'index'
32     plot.ylabel = 'y'
33    
34     plot.linestyle = 'lines'
35    
36     # assign some data to the plot
37     plot.setData(y)
38    
39     # render the scene to screen
40     scene.render(pause=True, interactive=True)
41    
42     # save the scene to file
43     plot.setData(y) # have to do this now because we've already render()ed
44     # the scene. This requirement will be removed in the
45     # future
46     scene.save(fname="singleArrayLinePlot.png", format=PngImage())
47    
48     # vim: expandtab shiftwidth=4:
49    

  ViewVC Help
Powered by ViewVC 1.1.26