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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
@Section
@Title { Ticks and labels }
@Tag { ticks }
@Begin
@PP
@I Ticks are the short lines that mark off intervals along the axes, and
graphs. @RawIndex { graphs (statistical) }
graphs.ticks @SubIndex { ticks }
ticks.graph @Index { ticks in graphs }
graphs. @RawIndex { graphs (statistical) }
graphs.labels @SubIndex { labels }
labels. @RawIndex { labels }
labels.in.graphs @SubIndex { in graphs }
@I labels are the numbers appearing near the ticks (not to be confused
with captions). {@Code "@Graph"} produces ticks and labels automatically
with some care, so it is probably best not to worry about them unless the
result is not pleasing, in which case there are options for controlling them.
@PP
One simple way to control the production of x ticks is with the
{@Code xmin}, {@Code xmax}, and {@Code xticksep} options to @Code
graphs. @RawIndex { graphs (statistical) }
graphs.xmin @SubIndex { @Code xmin option }
xmin.graph @Index { @Code "xmin" option (graphs) }
graphs. @RawIndex { graphs (statistical) }
graphs.xmax @SubIndex { @Code xmax option }
xmax.graph @Index { @Code "xmax" option (graphs) }
graphs. @RawIndex { graphs (statistical) }
graphs.xticksep @SubIndex { @Code xticksep option }
xticksep.graph @Index { @Code "xticksep" option (graphs) }
"@Graph". For example,
@ID @OneRow @Code {
"@Graph"
" xmin { 0 }"
" xmax { 5 }"
" xticksep { 0.5 }"
}
specifies that x values in the range 0 to 5 are to be expected, and that
a tick and label is to appear every 0.5 units along the x axis. One or
both of @Code "xmin" and @Code "xmax" may be omitted, in which case
suitable values will be inferred from the data as usual.
@PP
Alternatively, complete control over the appearance of x ticks and labels
is provided by the @Code "xticks" option. For example,
graphs. @RawIndex { graphs (statistical) }
graphs.xticks @SubIndex { @Code xticks option }
xticks.graph @Index { @Code "xticks" option (graphs) }
@ID @OneRow @Code {
"@Graph"
" xticks { 0@ 5 10@ 15 20@ }"
}
specifies that x ticks are to be drawn at 0, 5, 10, 15, and 20. An
@Code "@" following a number indicates that a label is to be printed as
well, so the above example will produce labels at 0, 10, and 20. For
even finer control, @Code "@" may be replaced by a label enclosed
in parentheses:
@ID @OneRow @Code {
"@Graph"
" xticks { 1 (Democrat) 2 (Republican) 3 (Other) }"
}
As this example shows, a label does not have to be a number; it can be
any string of characters, including spaces and balanced parentheses;
but it may not be an arbitrary Lout object.
@PP
The character @Code "^" in a label indicates that the
remainder is to be treated as an exponent:
@ID @OneRow @Code {
"@Graph"
" xlog { 10 }"
" xticks { 1 (1) 10 (10) 100 (10^2) 1000 (10^3) 10000 (10^4) 100000 (10^5) }"
"{"
" @Data points { plus }"
" { 1 2.1 10 3.4 100 4.9 1000 6.1 10000 7.2 100000 7.6 }"
"}"
}
In fact, the labels inserted automatically when @Code xticks is omitted have
exponents when the axis is logarithmic, so @Code xticks is hardly necessary
in this example. Anyway the result is
@CD @Graph
height { 3c }
xlog { 10 }
xticks { 1 (1) 10 (10) 100 (10^2) 1000 (10^3) 10000 (10^4) 100000 (10^5) }
{
@Data points { plus }
{
1 2.1 10 3.4 100 4.9 1000 6.1 10000 7.2 100000 7.6
}
}
Setting @Code "xticks" to empty produces no x ticks (this is not the
same as omitting {@Code xticks}).
@PP
Similar options control ticks and labels on the y axis: {@Code "ymin"},
{@Code "ymax"}, {@Code "yticksep"}, and {@Code "yticks"}. There are
graphs. @RawIndex { graphs (statistical) }
graphs.ymin @SubIndex { @Code ymin option }
ymin.graph @Index { @Code "ymin" option (graphs) }
graphs. @RawIndex { graphs (statistical) }
graphs.ymax @SubIndex { @Code ymax option }
ymax.graph @Index { @Code "ymax" option (graphs) }
graphs. @RawIndex { graphs (statistical) }
graphs.yticksep @SubIndex { @Code yticksep option }
yticksep.graph @Index { @Code "yticksep" option (graphs) }
graphs. @RawIndex { graphs (statistical) }
graphs.yticks @SubIndex { @Code yticks option }
yticks.graph @Index { @Code "yticks" option (graphs) }
also @Code "xticklength" and @Code "yticklength" options which set
the length of ticks:
graphs. @RawIndex { graphs (statistical) }
graphs.xticklength @SubIndex { @Code xticklength option }
xticklength.graph @Index { @Code "xticklength" option (graphs) }
graphs. @RawIndex { graphs (statistical) }
graphs.yticklength @SubIndex { @Code yticklength option }
yticklength.graph @Index { @Code "yticklength" option (graphs) }
@ID @OneRow @Code {
"@Graph"
" xticklength { 0.5f }"
" yticklength { 0.5f }"
}
shows the default values, half the current font size in both cases.
@PP
There is also an {@Code "rticks"} option which is similar to
graphs. @RawIndex { graphs (statistical) }
graphs.rticks @SubIndex { @Code rticks option }
rticks.graph @Index { @Code "rticks" option (graphs) }
{@Code "yticks"} except that the ticks it controls appear on the
right-hand side of the frame (this option is relevant only when
the @Code style option is {@Code frame}). Unlike @Code "xticks" and
{@Code "yticks"}, {@Code "rticks"} has empty default value, which is
why you don't usually see r ticks. They are most useful when overstriking
two graphs using @Code "@OverStrike" as explained earlier; one graph will
have y ticks in the usual way, the other will have r ticks and empty
y ticks:
@CD {
@Graph
style { frame }
width { 6c }
height { 6c }
xextra { 0c }
yextra { 0c }
rightcaption { -90d @Rotate { Precipitation mm } }
rightgap { 3.0f }
hidecaptions { no }
xmin { 0 }
xmax { 12 }
ymin { 0 }
ymax { 450 }
xticks { }
xticklength { 0c }
rticks { 0@ 50@ 100@ 150@ 200@ 250@ 300@ 350@ 400@ 450@ }
yticks {}
{
@Data
pairs { filledyhisto }
colour { blue }
linewidth { 1 pt }
{
0 340
1 410
2 430
3 340
4 290
5 175
6 140
7 125
8 110
9 100
10 85
11 175
12 0
}
}
@OverStrike
@Graph
style { frame }
width { 6c }
height { 6c }
xextra { 0c }
yextra { 0c }
leftcaption { 90d @Rotate { Temperature {@Degree}C } }
leftgap { 2.5f }
hidecaptions { no }
xmin { 0 }
xmax { 12 }
ymin { -30 }
ymax { 50 }
xticks {
0.5 (J)
1.5 (F)
2.5 (M)
3.5 (A)
4.5 (M)
5.5 (J)
6.5 (J)
7.5 (A)
8.5 (S)
9.5 (O)
10.5 (N)
11.5 (D)
}
xticklength { 0c }
yticks { -30@ -20@ -10@ 0@ 10@ 20@ 30@ 40@ }
{
@Data
pairs { solid }
colour { red }
linewidth { 1 pt }
{
0.0 24
1.0 24
2.0 25
3.0 26
4.0 26
5.0 26
6.0 26
7.0 27
8.0 26
9.0 27
10.0 28
11.0 28
12.0 26
}
}
}
Here the first graph has
@ID @Code {
"rticks { 0@ 50@ 100@ 150@ 200@ 250@ 300@ 350@ 400@ 450@ }"
"yticks {}"
}
for its ticks. This graph uses other features that we have not
come to yet, but anyway its source is:
@ID 0.95 @Scale -1px @Break @OneRow @Code @Verbatim {
@Graph
style { frame }
width { 6c }
height { 6c }
xextra { 0c }
yextra { 0c }
rightcaption { -90d @Rotate { Precipitation mm } }
rightgap { 3.0f }
hidecaptions { no }
xmin { 0 }
xmax { 12 }
ymin { 0 }
ymax { 450 }
xticks { }
xticklength { 0c }
rticks { 0@ 50@ 100@ 150@ 200@ 250@ 300@ 350@ 400@ 450@ }
yticks {}
{
@Data pairs { filledyhisto } colour { blue } linewidth { 1 pt }
{
0 340 1 410 2 430 3 340 4 290 5 175 6 140
7 125 8 110 9 100 10 85 11 175 12 0
}
}
@OverStrike
@Graph
style { frame }
width { 6c }
height { 6c }
xextra { 0c }
yextra { 0c }
leftcaption { 90d @Rotate { Temperature {@Degree}C } }
leftgap { 2.5f }
hidecaptions { no }
xmin { 0 }
xmax { 12 }
ymin { -30 }
ymax { 50 }
xticks {
0.5 (J) 1.5 (F) 2.5 (M) 3.5 (A) 4.5 (M) 5.5 (J)
6.5 (J) 7.5 (A) 8.5 (S) 9.5 (O) 10.5 (N) 11.5 (D)
}
xticklength { 0c }
yticks { -30@ -20@ -10@ 0@ 10@ 20@ 30@ 40@ }
{
@Data pairs { solid } colour { red } linewidth { 1 pt }
{
0.0 24 1.0 24 2.0 25 3.0 26 4.0 26 5.0 26 6.0
26 7.0 27 8.0 26 9.0 27 10.0 28 11.0 28 12.0 26
}
}
}
Lout has only a hazy idea of how much space is occupied by ticks and
labels. Unless @Code "xticks" is empty, Lout allows 1.7 times the
current font size below the graph for x ticks and labels, which is
usually about right; but it does not allow any space for y and r ticks and
labels since it has no idea how wide the labels will be. The discussion
of captions in Section {@NumberOf captions} explains how to use the
@Code "leftgap" and @Code "rightgap" options to work around this deficiency.
@End @Section
|