File: cumufrac.pl

package info (click to toggle)
ploticus 2.33-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,608 kB
  • ctags: 2,838
  • sloc: ansic: 48,139; perl: 913; sh: 393; makefile: 138
file content (165 lines) | stat: -rw-r--r-- 3,368 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// 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

// CUMUFRAC - cumulative fraction plot

// logmode 		pass as 'log' for log plot 
// x x2
// linedet, linedet2
// name, name2


#setifnotgiven logmode = linear
#setifnotgiven x2 = ""
#setifnotgiven rectangle = "2 2 7 5"
    // (what about cm units??)
#setifnotgiven linedet = "color=green width=0.5"
#setifnotgiven linedet2 = "color=red width=0.5"

#setifnotgiven name = "#usefname"
#setifnotgiven name2 = "#usefname"
#if @CM_UNITS = 1
  #setifnotgiven legend = "min+1.2 min-1.2"
#else
  #setifnotgiven legend = "min+0.5 min-0.5"
#endif


/// get standard parameters..
#include $chunk_setstd

/// read the data for the 1st curve..
/// the select screens out missing data codes and other non-numerics..
#set select = "$isnumber(@" @x ") = 1" 
#include $chunk_read


#musthave x

// chunk_area uses unittyp...
#set unittype = @logmode

/// set up plotting area...
#include $chunk_area
yrange: 0 @NRECORDS
#if @logmode = linear
  xautorange: datafield=@x,@x2 nearest=@xnearest 
#else
  xautorange: datafield=@x,@x2 mininit=0.05 nearest=@xnearest 
#endif
#endproc



///// do x axis (y axis done below)..
#proc xaxis
#ifspec xlbl label
#ifspec xlbldet labeldetails
#if @logmode != "linear"
  selflocatingstubs: text
  #include $chunk_logstubs
#else
  stubs: inc @xinc
#endif
#ifspec @stubfmt
stubrange: @XMIN
#ifspec @stubvert
#ifspec xgrid grid
location: min-0.2
stubcull: yes


#if @logmode != "linear"
  // do log tic marks..
  #proc xaxis
  location: min-0.2
  selflocatingstubs: text
  #include $chunk_logtics
#endif

/// title..
#include $chunk_title

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

///// plot the curve using accum and instancemode..
#proc lineplot
xfield: @x
linedetails: @linedet 
sort: yes
instancemode: yes
accum: yes
stairstep: yes
#if @logmode = "linear"
  firstpoint: 0 0
#endif
lastseglen: 0.2
legendlabel: @name
#saveas L

#if @x2 != ""
  /// read the data for the 2nd curve..
  /// the select screens out missing data codes and other non-numerics..
  #set select = "$isnumber(@" @x2 ") = 1" 
  #include $chunk_read

  #include $chunk_area
  yrange: 0 @NRECORDS
  xrange: @XMIN @XMAX
      // set in first areadef above..

  // plot 2nd curve
  #proc lineplot
  #clone: L
  xfield: @x2
  linedetails: @linedet2
  legendlabel: @name2
#endif


///// draw a plotting area frame allowing a small margin below X=0 and below Y=0..
#proc line
linedetails: width=0.5 color=black
points: min-0.2 min-0.2 max+0.2 min-0.2
	max+0.2 max+0.2
	min-0.2 max+0.2
	min-0.2 min-0.2


///// redraw the plotting area so we can express Y axis as a percentage 0.0 to 1.0 ..
#proc areadef
rectangle: @rectangle
xrange: 0 1
yrange: 0 1
yaxis.stubs: inc 0.2
yaxis.location: min-0.2



// do legend
#if @legend != "no"
  #if @name != "#usefname" || @header = yes
    #proc legend
    location: @legend
    #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
#endif


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