summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgfplots/test/pgfplotstest/pgfplotstest.scaling.tex
blob: d52d8024dab5c42b8a4163c2857ac6fb68ca9da4 (plain)
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
\testfile{pgfplotstest.scaling.tex}
\testsection{Standard placement normal plot}
\begin{tikzpicture}
\begin{axis}
\smallplotstest
\end{axis}
\end{tikzpicture}


\testsection{Scaling tests}
\testsubsection{width=5cm}
\begin{tikzpicture}
\begin{axis}[width=5cm]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{width=linewidth}
\begin{tikzpicture}
\begin{axis}[width=\linewidth]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{width=linewidth, height=textheight}
\begin{tikzpicture}
\begin{axis}[height=\textheight,width=\linewidth]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{height=3cm}
\begin{tikzpicture}
\begin{axis}[height=3cm]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{x=3cm}
\hrule width3cm height1pt
\vskip10pt
\begin{tikzpicture}[baseline]
\begin{axis}[x=3cm]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{x=3cm, y=4cm}
\hrule width3cm height1pt
\noindent
\vrule height4cm width1pt
\hskip10pt
\begin{tikzpicture}[baseline]
\begin{axis}[x=3cm,y=4cm]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{y=3cm}
\noindent
\vrule height3cm width1pt
\hskip10pt
\begin{tikzpicture}[baseline]
\begin{axis}[y=3cm]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{Scale vs. Datascale trafo}
All should have the same size; especially the same height.
This tests the data scale transformation and rounding inaccuracies during the computation of $x$~and~$y$ unit vectors,
\[ x = \frac{W}{T(\bar x) - T(\underline x)}. \]
The larger $x$, the higher the scaling accuracy. Large $x$ means small $T(\bar x) - T(\underline x)$ (relative to width~$W$). But this implies low accuracy for the input data! And nobody wants inaccurate plots.

The datascale transformation~$T$ is set up such that $O(W) = O(x)$, but I am not sure if I need to adjust some parameters. Some parameters lead to inaccurate~$x$ and~$y$ vectors, such that axis sizes are \emph{not} the same although $W$~and~$H$ (width and height) are the same.

\noindent
{\pgfplotsset{every picture/.append style={baseline}}
\pgfplotsset{every axis/.append style={width=3cm,scale only axis,ytick=\empty,cycle list=blue}}%
\def\TESTPLOTS{%
\begin{tikzpicture}%
\begin{axis}
\addplot plot coordinates {
	(0.000000,	0.113142)
	(0.062500,	0.114457)
	(0.125000,	0.115773)
	(0.187500,	0.117088)
	(0.250000,	0.118404)
	(0.312500,	0.119719)
	(0.375000,	0.121035)
	(0.437500,	0.122350)
	(0.500000,	0.123666)
	(0.562500,	0.124981)
	(0.625000,	0.126297)
	(0.687500,	0.127612)
	(0.750000,	0.128928)
	(0.812500,	0.130243)
	(0.875000,	0.131559)
	(0.937500,	0.132874)
	(1.000000,	0.134190)
};
\end{axis}
\end{tikzpicture}%
\begin{tikzpicture}%
\begin{axis}
\addplot plot coordinates {
	(0.000000,	0.192392)
	(0.020408,	0.551660)
	(0.040816,	0.816371)
	(0.061224,	0.957528)
	(0.081633,	0.936301)
	(0.102041,	0.784097)
	(0.122449,	0.539922)
	(0.142857,	0.257432)
	(0.163265,	-0.039651)
	(0.183673,	-0.313379)
	(0.204082,	-0.533386)
	(0.224490,	-0.712582)
	(0.244898,	-0.856655)
	(0.265306,	-0.932880)
	(0.285714,	-0.953862)
	(0.306122,	-0.957749)
	(0.326531,	-0.890993)
	(0.346939,	-0.774152)
	(0.367347,	-0.602360)
	(0.387755,	-0.396801)
	(0.408163,	-0.132261)
	(0.428571,	0.161664)
	(0.448980,	0.460018)
	(0.469388,	0.720198)
	(0.489796,	0.880398)
	(0.510204,	0.967384)
	(0.530612,	0.900632)
	(0.551020,	0.729232)
	(0.571429,	0.460479)
	(0.591837,	0.155311)
	(0.612245,	-0.153827)
	(0.632653,	-0.430787)
	(0.653061,	-0.653561)
	(0.673469,	-0.819444)
	(0.693878,	-0.931060)
	(0.714286,	-0.984394)
	(0.734694,	-0.981970)
	(0.755102,	-0.940272)
	(0.775510,	-0.825804)
	(0.795918,	-0.664138)
	(0.816327,	-0.465371)
	(0.836735,	-0.219185)
	(0.857143,	0.070697)
	(0.877551,	0.377456)
	(0.897959,	0.658660)
	(0.918367,	0.853564)
	(0.938776,	0.925472)
	(0.959184,	0.868936)
	(0.979592,	0.629528)
	(1.000000,	0.228732)
};
\end{axis}
\end{tikzpicture}%
\begin{tikzpicture}%
\begin{axis}

\addplot plot coordinates {
	(0.000000,	0.112104)
	(0.062500,	0.098029)
	(0.125000,	0.083954)
	(0.187500,	0.069879)
	(0.250000,	0.055804)
	(0.312500,	0.041729)
	(0.375000,	0.027654)
	(0.437500,	0.013579)
	(0.500000,	-0.000496)
	(0.562500,	-0.014571)
	(0.625000,	-0.028646)
	(0.687500,	-0.042722)
	(0.750000,	-0.056797)
	(0.812500,	-0.070872)
	(0.875000,	-0.084947)
	(0.937500,	-0.099022)
	(1.000000,	-0.113097)
};
\end{axis}
\end{tikzpicture}%
\begin{tikzpicture}%
\begin{axis}
\addplot plot coordinates {
	(0.000000,	-0.963159)
	(0.020408,	-0.781664)
	(0.040816,	-0.488585)
	(0.061224,	-0.137738)
	(0.081633,	0.234861)
	(0.102041,	0.556489)
	(0.122449,	0.791942)
	(0.142857,	0.941856)
	(0.163265,	0.977486)
	(0.183673,	0.930499)
	(0.204082,	0.809581)
	(0.224490,	0.653308)
	(0.244898,	0.474588)
	(0.265306,	0.268631)
	(0.285714,	0.048692)
	(0.306122,	-0.168568)
	(0.326531,	-0.380963)
	(0.346939,	-0.577633)
	(0.367347,	-0.751043)
	(0.387755,	-0.893755)
	(0.408163,	-0.960465)
	(0.428571,	-0.932380)
	(0.448980,	-0.841830)
	(0.469388,	-0.650880)
	(0.489796,	-0.346509)
	(0.510204,	-0.007265)
	(0.530612,	0.329744)
	(0.551020,	0.621489)
	(0.571429,	0.826905)
	(0.591837,	0.947602)
	(0.612245,	0.956706)
	(0.632653,	0.872426)
	(0.653061,	0.724325)
	(0.673469,	0.528915)
	(0.693878,	0.310032)
	(0.714286,	0.081807)
	(0.734694,	-0.143046)
	(0.755102,	-0.363063)
	(0.775510,	-0.559141)
	(0.795918,	-0.733031)
	(0.816327,	-0.880063)
	(0.836735,	-0.959350)
	(0.857143,	-0.968957)
	(0.877551,	-0.885145)
	(0.897959,	-0.702171)
	(0.918367,	-0.410704)
	(0.938776,	-0.035900)
	(0.959184,	0.359062)
	(0.979592,	0.719407)
	(1.000000,	0.940563)
};
\end{axis}
\end{tikzpicture}%
}%
\TESTPLOTS

once more again without `scale only axis':
\pgfplotsset{every axis/.append style={scale only axis=false}}%

\TESTPLOTS
}

\testsubsection{Testing numeric artefacts around tick position `0'}
{\pgfplotsset{every axis/.append style={scaled ticks=false}}
[scaled ticks=false] in this subsection

\begin{tikzpicture}
\begin{axis}
	\addplot coordinates {
		(-4.5,-8)
		(16,12)
	};
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}
	\addplot coordinates {
		(-0.7,-8)
		(1.3,12)
	};
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}
	\addplot coordinates {
		(-7000,-0.0008)
		(13000,0.0012)
	};
\end{axis}
\end{tikzpicture}
}

\testsection{Scaling log plots}
\hrule
\nobreak
\vskip10pt
\nobreak
\noindent
\begin{tikzpicture}
\begin{loglogaxis}[width=\linewidth]
\loglogtestplot
\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{loglogaxis}[width=\linewidth,height=\textheight]
\loglogtestplot
\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{loglogaxis}[height=5.5cm]
\loglogtestplot
\end{loglogaxis}
\end{tikzpicture}

\testsection{Scaletest}

{
\pgfplotsset{every axis/.append style={cycle list={%
	red,only marks,mark options={fill=red!80!black},mark=*\\%
	black,only marks,mark options={fill=black},mark=square*\\%
	}}}
\begin{tikzpicture}
\begin{axis}[%
	width=8cm,
	height=2cm,
	xtick=\empty,
	ytick=\empty
]

\addplot plot coordinates {
	(0.968555,	0.000000)
	(0.984277,	0.000000)
	(0.030884,	0.000000)
	(0.250000,	0.000000)
	(0.750000,	0.000000)
	(0.468750,	0.000000)
	(0.750000,	0.000000)
	(0.484375,	0.000000)
	(0.968555,	0.000000)
	(0.968555,	0.000000)
	(1.000000,	0.000000)
	(1.000000,	0.000000)
	(0.030176,	0.000000)
	(0.250000,	0.000000)
	(0.250000,	0.000000)
	(0.250000,	0.000000)
	(0.750000,	0.000000)
	(1.000000,	0.000000)
	(0.500000,	0.000000)
	(0.500000,	0.000000)
	(0.234375,	0.000000)
	(0.500000,	0.000000)
	(0.750000,	0.000000)
	(0.000000,	0.000000)
	(0.750000,	0.000000)
	(0.468750,	0.000000)
	(0.500000,	0.000000)
	(0.000000,	0.000000)
	(0.468750,	0.000000)
	(0.000000,	0.000000)
	(0.750000,	0.000000)
	(0.000000,	0.000000)
	(0.234375,	0.000000)
	(1.000000,	0.000000)
};
\addplot plot coordinates {
	(0.367188,	0.000000)
	(0.625000,	0.000000)
	(0.312500,	0.000000)
	(0.656250,	0.000000)
	(0.312500,	0.000000)
	(0.148438,	0.000000)
	(0.125000,	0.000000)
	(0.640625,	0.000000)
	(0.136719,	0.000000)
	(0.875000,	0.000000)
	(0.390625,	0.000000)
	(0.828125,	0.000000)
	(0.875000,	0.000000)
	(0.656250,	0.000000)
	(0.125000,	0.000000)
	(0.343750,	0.000000)
	(0.861328,	0.000000)
	(0.312500,	0.000000)
	(0.578125,	0.000000)
	(0.578125,	0.000000)
	(0.625000,	0.000000)
	(0.375000,	0.000000)
	(0.875000,	0.000000)
	(0.812500,	0.000000)
	(0.847656,	0.000000)
	(0.589844,	0.000000)
	(0.343750,	0.000000)
	(0.125000,	0.000000)
	(0.875000,	0.000000)
	(0.125000,	0.000000)
	(0.609375,	0.000000)
	(0.156250,	0.000000)
};
\end{axis}
\end{tikzpicture}
}

\testsection{Scaling test for very small or very large x values}
{
\testsubsection{1e-2}
\begin{tikzpicture}
\begin{axis}
	\addplot plot coordinates {
		(0.005,1)
		(0.01,2)
		(0.02,4)
	};
\end{axis}
\end{tikzpicture}

\testsubsection{1e+2}
% \tracingmacros=2\tracingcommands=2
\begin{tikzpicture}
\begin{axis}
	\addplot plot coordinates {
		(50,1)
		(100,2)
		(200,4)
	};
\end{axis}
\end{tikzpicture}
% \tracingmacros=0\tracingcommands=0

\testsubsection{x=1e+11; y=1e-6}
{
%\pgfplotsset{every x tick label/.append style={font=\Huge}}
%\pgfplotsset{every x tick scale label/.append style={anchor=base}}
\begin{tikzpicture}
\begin{axis}
	\addplot plot coordinates {
		(5e10,1e-6)
		(1e11,2e-6)
		(2e11,4e-6)
	};
\end{axis}
\end{tikzpicture}
}

\testsubsection{1e+1}
\begin{tikzpicture}
\begin{axis}
	\addplot plot coordinates {
		(5,1)
		(10,2)
		(20,4)
	};
\end{axis}
\end{tikzpicture}

\testsubsection{1e+3}
\begin{tikzpicture}
\begin{axis}
	\addplot plot coordinates {
		(0.5,1e3)
		(10,2e3)
		(200,4e3)
	};
\end{axis}
\end{tikzpicture}

\testsubsection{1e+4}
\begin{tikzpicture}
\begin{axis}
	\addplot plot coordinates {
		(0.1,2e4)
		(0.2,4e4)
		(0.5,1e4)
	};
\end{axis}
\end{tikzpicture}

\testsubsection{1e-2, 1e+4}
\begin{tikzpicture}
\begin{axis}
	\addplot plot coordinates {
		(0.01,2e4)
		(0.02,4e4)
		(0.05,1e4)
	};
\end{axis}
\end{tikzpicture}
}