File: stack.pl

package info (click to toggle)
ploticus 2.42-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,228 kB
  • sloc: ansic: 46,243; perl: 1,590; sh: 392; makefile: 123
file content (212 lines) | stat: -rw-r--r-- 4,172 bytes parent folder | download | duplicates (8)
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
// 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 xnumeric = ""
#setifnotgiven y2 = ""
#setifnotgiven y3 = ""
#setifnotgiven y4 = ""
#setifnotgiven color = orange
#setifnotgiven color2 = "powderblue"
#setifnotgiven color3 = "dullyellow"
#setifnotgiven color4 = "drabgreen"
#setifnotgiven name = "#usefname"
#setifnotgiven name2 = "#usefname"
#setifnotgiven name3 = "#usefname"
#setifnotgiven name4 = "#usefname"
#setifnotgiven outline = no
#setifnotgiven reverseleg = no
#setifnotgiven stackarea = 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..
#set context = stack
#include $chunk_read

#if @xnumeric != yes
  #proc categories
  axis: x
  datafield: @x
#endif

//// plot area..
#include $chunk_area
#if @xnumeric = yes
  #set incmult = 2.0
  #if @stackarea = yes
    #set incmult = 1.0
  #endif
  #write stderr
    incmult = @incmult
  #endwrite
  xautorange: datafield=@x incmult=@incmult nearest=@xnearest
#else
  xscaletype: categories
  // xcategories: datafield=@x
  // following added 9/2/02 scg
  // catcompmethod: exact
#endif

#if @stackarea = yes
  #set combomode = normal
#else
  #set combomode = stack
#endif
#if @yrange = ""
  yautorange: datafields=@y,@y2,@y3,@y4 combomode=@combomode incmult=2.0  nearest=@ynearest
//#elseif @yrange = 0
#elseif $ntoken( 2, @yrange ) = ""
  yautorange: datafields=@y,@y2,@y3,@y4 combomode=@combomode incmult=2.0 mininit=@yrange nearest=@ynearest
#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

#if @stackarea = yes
  #if @name = "#usefname"
    #set name = "Tier 1"
    #set name2 = "Tier 2"
    #set name3 = "Tier 3"
    #set name4 = "Tier 4"
    #write stderr
       Warning: With stackarea, legend labels must be specified (name= .. name2=..)
    #endwrite
  #endif
  #if @y4 != ""
    #proc lineplot 
     xfield: @x
     yfield: @y4
     fill: @color4
     legendlabel: @name4
  #endif
  #if @y3 != ""
    #proc lineplot 
     xfield: @x
     yfield: @y3
     fill: @color3
     legendlabel: @name3
  #endif
  #if @y2 != ""
    #proc lineplot 
     xfield: @x
     yfield: @y2
     fill: @color2
     legendlabel: @name2
  #endif
  #proc lineplot
  xfield: @x
  yfield: @y
  fill: @color
  legendlabel: @name

#else
  
  //// do 1st level bars..
  #proc bars
  locfield: @x
  lenfield: @y
  color: @color
  outline: @outline
  #ifspec barwidth
  legendlabel: @name
  #ifspec ptselect select
  
  //// 2nd level bars..
  #if @y2 != ""
    #proc bars
    locfield: @x
    lenfield: @y2
    stackfields: *
    color: @color2
    outline: @outline
    #ifspec barwidth
    legendlabel: @name2
    #ifspec ptselect2 select
  #endif
  
  //// 3rd level bars..
  #if @y3 != ""
    #proc bars
    locfield: @x
    lenfield: @y3
    stackfields: *
    color: @color3
    outline: @outline
    #ifspec barwidth
    legendlabel: @name3
    #ifspec ptselect3 select
  #endif
  
  //// 4th level bars..
  #if @y4 != ""
    #proc bars
    locfield: @x
    lenfield: @y4
    stackfields: *
    color: @color4
    outline: @outline
    #ifspec barwidth
    legendlabel: @name4
    #ifspec ptselect4 select
  #endif

#endif
  
//// legend..
#if @name != "#usefname" || @header = yes
  #proc legend
  location: @legend
  reverseorder: @reverseleg
  #ifspec legendfmt format
  #ifspec legendsep sep
  #ifspec legwrap wraplen
  #ifspec legbreak extent
  #ifspec legtitle title
  #ifspec legbox backcolor
  #ifspec legframe frame
  #ifspec legtextdet textdetails

#endif

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