aboutsummaryrefslogtreecommitdiffstats
path: root/doc/user/gra_over
blob: b459da81b3dcdc862b41b76f1d30dfc85f6d11bb (plain) (blame)
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
213
214
215
216
@Section
   @Title { Changing the overall appearance of the graph }
   @Tag { overall }
@Begin
@PP
The overall appearance of the graph is controlled by options to the
@Code "@Graph" symbol.  As usual, these options follow the @Code "@Graph"
symbol, with their values enclosed in braces; they may appear in any order,
and if omitted are assigned some sensible default value.
@PP
There is a @Code "style" option for controlling the overall style of the
graphs. @RawIndex { graphs (statistical) }
graphs.style @SubIndex { @Code style option }
style. @RawIndex { @Code "style" option }
style.in.graphs @SubIndex { in graphs }
axes. @Index { axes in graphs }
graph, whose value may be either {@Code "frame"}, {@Code "none"},
or {@Code "axes"}.  The default value is {@Code "frame"}, and it produces
a frame around the graph with ticks and labels along its left and bottom
edges, as in previous examples.  Value @Code "grid" is similar except
that the ticks are converted into grid lines crossing the entire
frame.  The {@Code "none"} style prints nothing (no frame, no ticks,
no labels), which is useful for producing graphs that don't look like
graphs, as it were.
@PP
If the other value, {@Code "axes"}, is chosen, two other options called
{@Code xorigin} and {@Code yorigin} become compulsory:
graphs. @RawIndex { graphs (statistical) }
graphs.xorigin @SubIndex { @Code xorigin option }
xorigin.graph @Index { @Code "xorigin" option (graphs) }
graphs. @RawIndex { graphs (statistical) }
graphs.yorigin @SubIndex { @Code yorigin option }
yorigin.graph @Index { @Code "yorigin" option (graphs) }
@ID @OneRow @Code @Verbatim {
-2p @Font @Graph
    style { axes }
    xorigin { 0 }
    yorigin { 0 }
    width { 12c }
    height { 7c }
    leftcaption { 90d @Rotate { counts (%) } }
    leftgap { 1.0c }
    belowcaption { time (min) }
    belowgap { 0c }
{
    @Data
        points { filledsquare }
        pairs { solid }
    { 0 0.0 1 4.8 2 7.0 3 15.2 4 19.8 5 20.0 6 21.0 7 25.0
      10 29.5 15 31.2 20 35.0 30 40.0 60 50.8
    }

    @Data
        points { square }
        pairs { solid }
    {
      0 0.0 1 3.7 1.5 43.1 2 99.1 3 85.6 4 69.1 5 47.0 6 44.1 7 40.8
      10 35.0 15 29.4 20 25.0 30 21.1 60 15.5
    }
}
}
We have requested a smaller font size for this graph as a whole by
preceding it with {@Code "-2p @Font"}, meaning two points smaller, and
we have used some other options which will be explained shortly.  The
resulting graph has an x axis and a y axis instead of a frame, like this:
@CD -2p @Font @Graph
    style { axes }
    xorigin { 0 }
    yorigin { 0 }
    width { 12c }
    height { 7c }
    leftcaption { 90d @Rotate { counts (%) } }
    leftgap { 1.0c }
    belowcaption { time (min) }
    belowgap { 0c }
{
    @Data
        points { filledsquare }
        pairs { solid }
    { 0 0.0 1 9.5 2 15.0 3 18.2 4 20.1 5 22.1 7 25.0
      10 28.3 15 31.2 20 35.0 30 40.0 60 50.8
    }

    @Data
        points { square }
        pairs { solid }
    {
      0 0.0 1 3.7 1.5 43.1 2 99.1 3 85.6 4 69.1 5 47.0 6 44.1 7 40.8
      10 35.0 15 29.4 20 25.0 30 21.1 60 15.5
    }
}
The point where the axes cross is ({@Code xorigin}, {@Code yorigin}).
@PP
Although @Code "@Graph" does not provide explicit support for
multiple axes, you can simulate them by overstriking two
separate graphs of equal size.  There is an @Code "@OverStrike"
overstrike. @Index @Code "@OverStrike"
symbol which overstrikes two objects, so
@ID @Code "@Graph { ... } @OverStrike @Graph { ... }"
will do the job.  Typically one of the graphs would have y ticks,
and the other would have r ticks (adjacent to the right-hand side of the
frame).
@PP
There are @Code "xlog" and @Code "ylog" options which produce
graphs. @RawIndex { graphs (statistical) }
graphs.xlog @SubIndex { @Code xlog option }
xlog.graph @Index { @Code "xlog" option (graphs) }
graphs. @RawIndex { graphs (statistical) }
graphs.ylog @SubIndex { @Code ylog option }
ylog.graph @Index { @Code "ylog" option (graphs) }
logarithmic.axes @Index { logarithmic axes in graphs }
logarithmic x and y axes:
@ID @OneRow @Code @Verbatim {
@Graph
    xlog { 10 }
    ylog { 10 }
{
    ...
}
}
The value is the base of the logarithm, usually 10 or 2, or
{@Code none} (the default) meaning not logarithmic.  Logarithms
to different bases differ only by a constant factor, so the main effect
of different bases is on the choice of ticks and labels.  An @Code "xlog"
option will be ignored if there are any negative or zero x data points,
x ticks, or {@Code "xorigin"} or {@Code "xmin"} options; and similarly
for {@Code "ylog"}.
@PP
There are @Code "width" and @Code "height" options for setting the size
graphs. @RawIndex { graphs (statistical) }
graphs.width @SubIndex { @Code width option }
width. @RawIndex { @Code "width" option }
width.in.graphs @SubIndex { in graphs }
graphs. @RawIndex { graphs (statistical) }
graphs.height @SubIndex { @Code height option }
height. @RawIndex { @Code "height" option }
height.in.graphs @SubIndex { in graphs }
of the total area enclosed:
@ID @OneRow @Code @Verbatim {
@Graph
    width { 6.0c }
    height { 4.0c }
{
    ...
}
}
This shows the default width and height, six centimetres and four
centimetres.  These lengths and others discussed below can be specified
using a variety of units of measurement (see Section {@NumberOf grsummary}
for the details).
@PP
Within the frame or axes, a small margin is kept free of data points.  The
size of this margin is controlled by @Code "xextra" and @Code "yextra"
graphs. @RawIndex { graphs (statistical) }
graphs.xextra @SubIndex { @Code xextra option }
xextra.graph @Index { @Code "xextra" option (graphs) }
graphs. @RawIndex { graphs (statistical) }
graphs.yextra @SubIndex { @Code yextra option }
yextra.graph @Index { @Code "yextra" option (graphs) }
options:
@ID @OneRow @Code @Verbatim {
@Graph
    xextra { 0.5c }
    yextra { 0.5c }
{
    ...
}
}
Setting @Code "xextra" to @Code "0.5c" (the default value if the
@Code style option is {@Code frame}) means that the smallest x value
will be placed 0.5 centimetres to the right of the left boundary, and
the largest will be placed 0.5 centimetres to the left of the right
boundary.  It is quite safe to set @Code "xextra" to @Code "0c" if
desired, and indeed this is the default value when @Code style is
{@Code axes} or {@Code none}.  The @Code "yextra" option works in
exactly the same way for y values.
@PP
The @Code "xdecreasing" option plots the x values in decreasing order
graphs. @RawIndex { graphs (statistical) }
graphs.xdecreasing @SubIndex { @Code xdecreasing option }
xdecreasing.graph @Index { @Code "xdecreasing" option (graphs) }
instead of increasing:
@ID @Code @Verbatim {
@Graph
    xdecreasing { yes }
    abovecaption { New South Wales road deaths, 1960--1990
(fatalities per 100 million vehicle km) }
{
    @Data
        points { plus }
        pairs { dashed }
    {
        1963 5.6  1971 4.3  1976 3.7  1979 3.4  1982 2.9  1985 2.3  1988 2.0
    }
}
}
produces
@CD @Graph
    xdecreasing { yes }
    abovecaption { New South Wales road deaths, 1960--1990
(fatalities per 100 million vehicle km) }
{
    @Data
        points { plus }
        pairs { dashed }
    {
        1963 5.6  1971 4.3  1976 3.7  1979 3.4  1982 2.9  1985 2.3  1988 2.0
    }
}
The value of @Code "xdecreasing" should be either @Code "no" (the default
value) or {@Code "yes"}.  A similar @Code "ydecreasing" option does the same
graphs. @RawIndex { graphs (statistical) }
graphs.ydecreasing @SubIndex { @Code ydecreasing option }
ydecreasing.graph @Index { @Code "ydecreasing" option (graphs) }
thing to the y axis.
@End @Section