File: stack.pl

package info (click to toggle)
ploticus 2.0.3-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,696 kB
  • ctags: 2,035
  • sloc: ansic: 40,100; perl: 456; sh: 186; makefile: 129
file content (143 lines) | stat: -rw-r--r-- 2,551 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// ploticus data display engine.  Software, documentation, and examples.  
// Copyright 1998-2002 Stephen C. Grubb  (scg@jax.org).
// Covered by GPL; see the file 'Copyright' for details. 
// http://ploticus.sourceforge.net

//// STACK - do a stacked bar graph 


//// load stack-specific parms..
#setifnotgiven barwidth = ""
#setifnotgiven xnumeric = ""
#setifnotgiven y2 = ""
#setifnotgiven y3 = ""
#setifnotgiven y4 = ""
#setifnotgiven color = orange
#setifnotgiven color2 = "powderblue"
#setifnotgiven color3 = "dullyellow"
#setifnotgiven color4 = "drabgreen"
#setifnotgiven name = ""
#setifnotgiven name2 = ""
#setifnotgiven name3 = ""
#setifnotgiven name4 = ""
#setifnotgiven outline = no
#if @CM_UNITS = 1
  #setifnotgiven legend = "min+1.25 max+1.25"
#else
  #setifnotgiven legend = "min+0.5 max+0.5"
#endif


//// load standard parms..
#include $chunk_setstd


//// read data..
#include $chunk_read


//// plot area..
#include $chunk_area
#if @xnumeric = yes
  xautorange: datafield=@x incmult=2.0
#else
  xscaletype: categories
  xcategories: datafield=@x
#endif
#if @yrange = ""
  yautorange: datafields=@y,@y2,@y3,@y4 combomode=stack incmult=2.0 
#elseif @yrange = 0
  yautorange: datafields=@y,@y2,@y3,@y4 combomode=stack incmult=2.0 lowfix=0
#else
  yrange: @yrange
#endif


//// x axis..
#include $chunk_xaxis
stubcull: yes
#if @xnumeric = yes
  stubs: inc @xinc
#else
  stubs: usecategories
#endif


//// y axis..
#include $chunk_yaxis
stubcull: yes


//// title..
#include $chunk_title


//// user pre-plot include..
#if @include1 != ""
  #include @include1
#endif


//// do 1st level bars..
#proc bars
locfield: @x
lenfield: @y
color: @color
outline: @outline
#if @barwidth != ""
  barwidth: @barwidth
#endif
legendlabel: @name

//// 2nd level bars..
#if @y2 != ""
  #proc bars
  locfield: @x
  lenfield: @y2
  stackfields: *
  color: @color2
  outline: @outline
  #if @barwidth != ""
    barwidth: @barwidth
  #endif
  legendlabel: @name2
#endif

//// 3rd level bars..
#if @y3 != ""
  #proc bars
  locfield: @x
  lenfield: @y3
  stackfields: *
  color: @color3
  outline: @outline
  #if @barwidth != ""
    barwidth: @barwidth
  #endif
  legendlabel: @name3
#endif

//// 4th level bars..
#if @y4 != ""
  #proc bars
  locfield: @x
  lenfield: @y4
  stackfields: *
  color: @color4
  outline: @outline
  #if @barwidth != ""
    barwidth: @barwidth
  #endif
  legendlabel: @name4
#endif

//// legend..
#if @name != ""
#proc legend
location: @legend
#endif

//// user post-plot include..
#if @include2 != ""
  #include @include2
#endif