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

Annotation of /trunk/pyvisi_old/examples/offsetPlotExample.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 786 - (hide annotations)
Tue Jul 25 04:58:05 2006 UTC (13 years, 3 months ago) by gross
File MIME type: text/x-python
File size: 2571 byte(s)
switched off pyvisi
1 cochrane 337 # $Id: offsetPlotExample.py,v 1.4 2005/05/24 01:37:50 paultcochrane Exp $
2     """
3     Example of plotting multiple curves offset from each other with pyvisi
4    
5     This is an example with simulated seismic data, and is a larger dataset
6     than seismicOffsetPlotExample.py
7 gross 637
8     @var __author__: name of author
9     @var __license__: licence agreement
10     @var __copyright__: copyrights
11     @var __url__: url entry point on documentation
12     @var __version__: version
13     @var __date__: date of the version
14 cochrane 337 """
15    
16 gross 637 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
17     http://www.access.edu.au
18     Primary Business: Queensland, Australia"""
19     __license__="""Licensed under the Open Software License version 3.0
20     http://www.opensource.org/licenses/osl-3.0.php"""
21     __author__="Paul Cochrane"
22     __url__="http://www.iservo.edu.au/esys"
23     __version__="$Revision$"
24     __date__="$Date$"
25    
26    
27 cochrane 337 # set up some data to plot
28     from Numeric import *
29    
30     # read in the data (being fortunate we know how much data there is)
31     fp = open('waves.dat')
32     t = zeros((100), typecode=Float)
33     x = zeros((13), typecode=Float)
34     data = zeros((100,13), typecode=Float)
35     for i in range(100):
36     for j in range(13):
37     line = fp.readline()
38     arr = line.split()
39     t[i] = float(arr[0])
40     x[j] = float(arr[1])
41     data[i,j] = float(arr[2])
42     fp.close()
43    
44     # example code for how a user would write a script in pyvisi
45 gross 605 from esys.pyvisi import * # base level visualisation stuff
46     #from esys.pyvisi.utils import * # pyvisi specific utils
47 cochrane 337 # import the objects to render the scene using the specific renderer
48 gross 605 #from esys.pyvisi.renderers.gnuplot import * # gnuplot
49     from esys.pyvisi.renderers.vtk import * # vtk
50 cochrane 337
51     # define the scene object
52     # a Scene is a container for all of the kinds of things you want to put
53     # into your plot for instance, images, meshes, arrow/vector/quiver plots,
54     # contour plots, spheres etc.
55     scene = Scene()
56    
57     # create an OffsetPlot object
58     plot = OffsetPlot(scene)
59    
60     # add some helpful info to the plot
61     plot.title = 'OffsetPlot example - waves.dat'
62     plot.xlabel = 't'
63     plot.ylabel = 'y'
64    
65     # assign some data to the plot
66     plot.setData(t, data)
67    
68     # render the scene to screen
69     scene.render(pause=True, interactive=True)
70    
71     # save the scene to file
72     # save as png
73     plot.setData(t, data)
74     # have to do this now because we've already
75     # render()ed the scene. This requirement
76     # will be removed in the future.
77     scene.save(fname="offsetPlotExample.png", format=PngImage())
78    
79     # vim: expandtab shiftwidth=4:
80    

  ViewVC Help
Powered by ViewVC 1.1.26