/[escript]/trunk/pyvisi/test/python/plplot/multiCurveLinePlot.py
ViewVC logotype

Contents of /trunk/pyvisi/test/python/plplot/multiCurveLinePlot.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 604 - (show annotations)
Mon Mar 20 02:23:14 2006 UTC (13 years, 7 months ago) by gross
File MIME type: text/x-python
File size: 1040 byte(s)
example cleanup
1 # $Id: multiCurveLinePlot.py,v 1.1 2005/05/05 01:57:24 paultcochrane Exp $
2
3 """
4 Example of plotting multiple curves with pyvisi
5 """
6
7 # what plotting method are we using?
8 method = 'pyvisi'
9
10 # set up some data to plot
11 from Numeric import *
12
13 x = arange(0, 2*pi, 0.1, typecode=Float)
14 y1 = sin(x)
15 y2 = cos(x)
16 y3 = cos(x)**2
17
18 import plplot
19
20 # determine the min and max of x
21 xMin = min(x)
22 xMax = max(x)
23
24 # determine the global min and max of all the y's
25 yAll = concatenate( [y1, y2, y3] )
26
27 yMin = min(yAll)
28 yMax = max(yAll)
29
30 plplot.plsdev("xwin")
31 plplot.plinit()
32 plplot.plenv(xMin, xMax, yMin, yMax, 0, 1)
33 plplot.pllab("x", "y", "Example 2D plot")
34 plplot.plline(x, y1)
35 plplot.plline(x, y2)
36 plplot.plline(x, y3)
37 plplot.plend()
38
39 # to save as well, have to set everything up again, and replot
40 # save as png
41 plplot.plsdev("png")
42 plplot.plsfnam("multiCurveLinePlot.png")
43 plplot.plinit()
44 plplot.plenv(xMin, xMax, yMin, yMax, 0, 1)
45 plplot.pllab("x", "y", "Example 2D plot")
46 plplot.plline(x, y1)
47 plplot.plline(x, y2)
48 plplot.plline(x, y3)
49 plplot.plend()
50

  ViewVC Help
Powered by ViewVC 1.1.26