~uhh-ssd/+junk/humidity_readout

« back to all changes in this revision

Viewing changes to plplot/plplot-5.9.9/examples/python/x12.py

  • Committer: Joachim Erfle
  • Date: 2013-07-24 13:53:41 UTC
  • Revision ID: joachim.erfle@desy.de-20130724135341-1qojpp701zsn009p
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
#
 
3
#       x12c.c
 
4
#
 
5
#       Bar chart demo.
 
6
 
 
7
import sys
 
8
import os
 
9
 
 
10
module_dir = "@MODULE_DIR@"
 
11
 
 
12
if module_dir[0] == '@':
 
13
        module_dir = os.getcwd ()
 
14
 
 
15
sys.path.insert (0, module_dir)
 
16
 
 
17
# main
 
18
#
 
19
# Does a simple bar chart, using color fill.  If color fill is
 
20
# unavailable, pattern fill is used instead (automatic).
 
21
 
 
22
def main(w):
 
23
 
 
24
##    # Parse and process command line arguments
 
25
##
 
26
##    pl.ParseOpts(sys.argv, pl.PARSE_FULL)
 
27
##
 
28
##    # Initialize plplot
 
29
##
 
30
##    pl.init()
 
31
 
 
32
    w.pladv(0)
 
33
    w.plvsta()
 
34
    w.plwind(1980.0, 1990.0, 0.0, 35.0)
 
35
    w.plbox("bc", 1.0, 0, "bcnv", 10.0, 0)
 
36
    w.plcol0(2)
 
37
    w.pllab("Year", "Widget Sales (millions)", "#frPLplot Example 12")
 
38
 
 
39
    y0 = [5, 15, 12, 24, 28, 30, 20, 8, 12, 3]
 
40
 
 
41
    for i in range(10):
 
42
        w.plcol0(i + 1)
 
43
        w.plpsty(0)
 
44
        fbox( w, (1980. + i), y0[i] )
 
45
        string = `y0[i]`
 
46
        w.plptex((1980. + i + .5), (y0[i] + 1.), 1.0, 0.0, .5, string)
 
47
        string = `1980 + i`
 
48
        w.plmtex("b", 1.0, ((i + 1) * .1 - .05), 0.5, string)
 
49
 
 
50
    # Don't forget to call PLEND to finish off!
 
51
 
 
52
    w.pleop()
 
53
 
 
54
def fbox( w, x0, y0 ):
 
55
 
 
56
    x = [x0, x0, x0 + 1., x0 + 1.]
 
57
    y = [0., y0, y0, 0.]
 
58
    w.plfill(x, y)
 
59
    w.plcol0(1)
 
60
    w.pllsty(1)
 
61
    w.plline(x, y)
 
62
 
 
63
##main()