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
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
|
%--------------------------------------------
%
% Package pgfplots.sty
%
% Provides a user-friendly interface to create function plots (normal
% plots, semi-logplots and double-logplots).
%
% It is based on Till Tantau's PGF package.
%
% Copyright 2007/2008 by Christian Feuersänger.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%
%--------------------------------------------
\def\pgfplotsversion{0.92.4}
\ProvidesPackage{pgfplots}[2008/02/17 Version \pgfplotsversion]
% ATTENTION:
% you MAY need one of
% \def\pgfsysdriver{pgfsys-dvipdfm.def}
% \def\pgfsysdriver{pgfsys-pdftex.def}
% \def\pgfsysdriver{pgfsys-dvips.def}
%
% BEFORE the first \usepackage{pgf}, \usepackage{tikz} or
% \usepackage{pgfplots}.
% Default is
% 'dvips' for 'latex'
% 'pdftex' for 'pdflatex'
% -> dvipdfm needs special attention.
\RequirePackage{xkeyval}[2006/11/18]
\RequirePackage{ifthen}
\RequirePackage{liststructure}
\RequirePackage{tikz}[2007/06/07]
\RequirePackage{sciformat}
\RequirePackage{pgfmathlog}
\usetikzlibrary{plotmarks}
\def\prefix{pgfplots}
% FIXME: reduce number of variables!
\newcount\axisticknum
\newcount\axis@tickposnum
\newcount\axis@xmode
\newcount\axis@ymode
\newcount\axis@numplots
\newdimen\axis@xcoordminTEX
\newdimen\axis@xcoordmaxTEX
\newdimen\axis@ycoordminTEX
\newdimen\axis@ycoordmaxTEX
\newdimen\axis@tmpa
\newdimen\axis@tmpb
\newif\ifaxis@isuniformtick
\newif\ifaxis@enlargelimits
\newif\ifaxis@enlargelimits@rel@thresh
\newif\ifaxis@enlargelimits@auto
\let\axis@TMP=\empty
\let\axis@TMPB=\empty
\let\axis@TMPC=\empty
\def\axis@leftover{}
\def\axis@rightover{}
\def\axisdefaultwidth{240pt}
\def\axisdefaultheight{207pt}
\def\axisdefaulttickwidth{35}% the maximum space between adjacent ticks (in pt, but don't specify the unit 'pt')
\def\axisdefaulttryminticks{4}
\listnew{\blackwhiteplotspeclist}{%
mark options={fill=gray},mark=*\\%
mark options={fill=gray},mark=square*\\%
mark options={fill=gray},mark=otimes*\\%
mark=star\\%
mark options={fill=gray},mark=diamond*\\%
densely dashed,mark options={solid,fill=gray},mark=*\\%
densely dashed,mark options={solid,fill=gray},mark=square*\\%
densely dashed,mark options={solid,fill=gray},mark=otimes*\\%
densely dashed,mark options={solid},mark=star\\%
densely dashed,mark options={solid,fill=gray},mark=diamond*\\%
}
\listnew{\coloredplotspeclist}{%
blue,mark options={fill=blue!80!black},mark=*\\%
red,mark options={fill=red!80!black},mark=square*\\%
brown!60!black,mark options={fill=brown!80!black},mark=otimes*\\%
black,mark=star\\%
blue,mark options={fill=blue!80!black},mark=diamond*\\%
red,densely dashed,mark options={solid,fill=red!80!black},mark=*\\%
brown!60!black,densely dashed,mark options={solid,fill=brown!80!black},mark=square*\\%
black,densely dashed,mark options={solid,fill=gray},mark=otimes*\\%
blue,densely dashed,mark=star,mark options=solid\\%
red,densely dashed,mark options={solid,fill=red!80!black},mark=diamond*\\%
}
\listcopy\coloredplotspeclist\to\autoplotspeclist%
%\listcopy\blackwhiteplotspeclist\to\autoplotspeclist%
\tikzstyle{every axis}=[]
\tikzstyle{every axis plot}=[]
\tikzstyle{every axis label}=[]
\tikzstyle{every axis x label}=[at={(0.5,0)},below,yshift=-15pt]
\tikzstyle{every axis y label}=[at={(0,0.5)},xshift=-35pt,rotate=90]
\tikzstyle{every axis title}=[at={(0.5,1)},above,yshift=6pt]
\tikzstyle{every tick}=[very thin,gray]
\tikzstyle{every minor tick}=[]
\tikzstyle{every major tick}=[]
\tikzstyle{every axis grid}=[style=help lines]
\tikzstyle{every minor grid}=[]
\tikzstyle{every major grid}=[]
\tikzstyle{every tick label}=[]
\tikzstyle{every x tick label}=[]
\tikzstyle{every y tick label}=[]
% specifies how and where to draw the axis.
% \tikzstyle{every axis legend}+=[at={(0,0)}]
% will draw it at the lower left corner of the axis while
% \tikzstyle{every axis legend}+=[at={(1,1)}]
% means the upper right corner.
%
% The legend is a 'node' so you can use any tikz option which affects
% nodes. The option 'text width' is set automatically, depending on
% the \legend[textwidth=...] option.
%
% Examples:
% - \tikzstyle{every axis legend}+=[at={(1.02,1)},anchor=north west]
% draws the legend OUTSIDE TOP RIGHT.
%
% - \tikzstyle{every axis legend}+=[at={(1,0.5)},anchor=east,outer sep=0.5cm]
% draws the legend INSIDE MIDDLE RIGHT, separated by 0.5cm from the axis.
\tikzstyle{every axis legend}=[%
cells={anchor=center},
inner xsep=3pt,inner ysep=2pt,nodes={inner sep=2pt,text depth=0.15em},
anchor=north east,%
shape=rectangle,%
fill=white,%
draw=black,
at={(0.98,0.98)}
]
% at={(1,1)},
% outer sep=0.1cm]
\define@cmdkeys[\prefix]{axis}[axis@]{%
xmin,xmax,xticklabel,xtick,xtickten,xlabel,%
ymin,ymax,yticklabel,ytick,ytickten,ylabel,%
subtickwidth,tickwidth,%
xfilter,yfilter,%
width,height,%
title,%
execute at begin plot,%
execute at end plot,%
enlargelimits,%
legend columns,%
x,y}%
\long\def\axis@foreach@to@list#1\to#2{%
\listnewempty\axis@TMP
\begingroup
\foreach \i in {#1} {%
\globaldefs=1
\expandafter\listpushback\i\to\axis@TMP
\globaldefs=0
}%
\endgroup
\listcopy\axis@TMP\to#2\relax
}
\define@cmdkey[\prefix]{axis}[axis@]{xticklabels}{%
\expandafter\axis@foreach@to@list\axis@xticklabels\to\axis@xticklabels
%\expandafter\listnew\expandafter\axis@xticklabels\expandafter{\axis@xticklabels}%
\let\axis@xticklabel=\axis@user@ticklabel@list@x
}
\define@cmdkey[\prefix]{axis}[axis@]{yticklabels}{%
\expandafter\axis@foreach@to@list\axis@yticklabels\to\axis@yticklabels
%\expandafter\listnew\expandafter\axis@yticklabels\expandafter{\axis@yticklabels}%
\let\axis@yticklabel=\axis@user@ticklabel@list@y
}
\define@cmdkey[\prefix]{axis}[axis@]{minor tick length}{%
\expandafter\let\expandafter\axis@subtickwidth\csname axis@minor tick length\endcsname
}
\define@cmdkey[\prefix]{axis}[axis@]{major tick length}{%
\expandafter\let\expandafter\axis@tickwidth\csname axis@major tick length\endcsname
}
% sets \axis@tickposnum to
% left=0
% right=1
% both=2
\define@choicekey[\prefix]{axis}{tickpos}[\val\nr]{left,right,both}{%
\axis@tickposnum=\nr\relax
}
\define@choicekey[\prefix]{axis}{legend plot pos}[\val\nr]{left,right,none}{%
\edef\axis@legend@plot@pos{\nr}%
}
\define@choicekey[\prefix]{axis}{anchor}[\val\nr]{north,north west,west,south west,south,south east,east,north east,center}{%
\edef\axis@anchorchoicenum{\nr}%
}
\define@choicekey[\prefix]{axis}{ticks}[\val\nr]{none,major,minor,both}{%
\expandafter\ifcase\nr\relax
\axis@xminorticksfalse
\axis@yminorticksfalse
\axis@xmajorticksfalse
\axis@ymajorticksfalse
\or
\axis@xminorticksfalse
\axis@yminorticksfalse
\axis@xmajortickstrue
\axis@ymajortickstrue
\or
\axis@xminortickstrue
\axis@yminortickstrue
\axis@xmajorticksfalse
\axis@ymajorticksfalse
\or
\axis@xminortickstrue
\axis@yminortickstrue
\axis@xmajortickstrue
\axis@ymajortickstrue
\fi
}
\define@choicekey[\prefix]{axis}{grid}[\val\nr]{none,major,minor,both}{%
\expandafter\ifcase\nr\relax
\axis@xminorgridsfalse
\axis@yminorgridsfalse
\axis@xmajorgridsfalse
\axis@ymajorgridsfalse
\or
\axis@xminorgridsfalse
\axis@yminorgridsfalse
\axis@xmajorgridstrue
\axis@ymajorgridstrue
\or
\axis@xminorgridstrue
\axis@yminorgridstrue
\axis@xmajorgridsfalse
\axis@ymajorgridsfalse
\or
\axis@xminorgridstrue
\axis@yminorgridstrue
\axis@xmajorgridstrue
\axis@ymajorgridstrue
\fi
}
\define@boolkeys[\prefix]{axis}[axis@]{%
xminorticks,%
xmajorticks,%
yminorticks,%
ymajorticks,%
xminorgrids,%
xmajorgrids,%
yminorgrids,%
ymajorgrids,%
disablelogfilter,%
disabledatascaling,%
hide axis,%
scale only axis}[true]
% sets \axis@xmode to
% normal=0
% log=1
\define@choicekey[\prefix]{axis}{xmode}[\val\nr]{normal,log}{%
\axis@xmode=\nr\relax
}
% sets \axis@ymode to
% normal=0
% log=1
\define@choicekey[\prefix]{axis}{ymode}[\val\nr]{normal,log}{%
\axis@ymode=\nr\relax
}
\long\def\axispreset#1{%
\presetkeys[\prefix]{axis}{#1}{}%
}
\long\def\legendpreset#1{%
\errmessage{Sorry, legendpreset is now deprecated, along with the legend options text width and font. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}%
}
\presetkeys[\prefix]{axis}{%
xmode=normal,
xmin=,
xmax=,
xlabel=,
xtick=,
xtickten=,
xticklabel=,
xminorticks=true,
xmajorticks=true,
xminorgrids=false,
xmajorgrids=false,
ymode=normal,
ymin=,
ymax=,
ylabel=,
ytick=,
ytickten=,
yticklabel=,
yminorticks=true,
ymajorticks=true,
yminorgrids=false,
ymajorgrids=false,
grid=none,%
tickpos=both,
xfilter=,
yfilter=,
title=,
width=,
height=,
anchor=south west,
subtickwidth=0.1cm,
tickwidth=0.15cm,
scale only axis=false,
hide axis=false,
legend columns=1,
legend plot pos=left,
x=,% is implicitly set by 'width' and/or '\axisdefaultwidth'
y=,% is implicitly set by 'height' and/or '\axisdefaultheight'
execute at begin plot=,%
execute at end plot=,%
enlargelimits=auto,
disablelogfilter=false}{}
\def\logten{2.3025851}
\def\reciproc@logten{0.434294481903252}
\newcommand{\logi}[1]{%
\ifcase#1
\or0
\or0.693147
\or1.098612
\or1.386294
\or1.60943791
\or1.7917594
\or1.94591014
\or2.07944154
\or2.197224
\fi
}
\newcommand{\show@yticklabel}[2]{{%
\let\ticknum=#1%
\ifaxis@float@numerics@mode@y
% this here stores \\tick@S, \\tick@M, \\tick@E
\axis@inverse@datascaletrafo@y{#2}\to\tick
% .. and this here provides \tick as fixed point repr:
\scitofixedsingle\tick\tick
\else
\def\tick{#2}%
\fi
\axis@yticklabel
}}
% x-Achsenbeschriftung zum #1.ten Tick:
% #1: die ticknum
% #2: der x wert dafuer
\newcommand{\show@xticklabel}[2]{{%
\let\ticknum=#1%
\ifaxis@float@numerics@mode@x
% this here stores \\tick@S, \\tick@M, \\tick@E
\axis@inverse@datascaletrafo@x{#2}\to\tick
% .. and this here provides \tick as fixed point repr:
\scitofixedsingle\tick\tick
\else
\def\tick{#2}%
\fi
\axis@xticklabel
}}
\def\axis@user@ticklabel@list@x{%
\listselect\ticknum\of\axis@xticklabels\to\tick
\tick
}
\def\axis@user@ticklabel@list@y{%
\listselect\ticknum\of\axis@yticklabels\to\tick
\tick
}
\newcommand{\axisdefaultticklabel}[0]{%
$\prettyprintnumber{\tick}$%
}
\newcommand{\axisdefaultticklabellog}[0]{%
\logtologtentomacro{\tick}{\roundedtick}%
$10^{\prettyprintnumber{\roundedtick}}$%
}
\newcommand{\axisshowxlabel}{%
\node
[style=every axis label,%
style=every axis x label]
{\axis@xlabel};
}
\newcommand{\axisshowylabel}{%
\node
[style=every axis label,
style=every axis y label]
{\axis@ylabel};
}
\newcommand{\axisshowtitle}{%
\node%
[style=every axis title]
{\axis@title};
}
% Y-Achsen und Achsenbeschriftung LOG:
% 1: Ticks
\newcommand{\axis@drawyaxis}[1]{%
\begingroup
\newif\ifneedsminorloop
\axisticknum=0
\edef\axis@TMP{#1}%
\ifx\axis@TMP\empty
\else
\ifaxis@yminorticks
\needsminorlooptrue
\fi
\ifaxis@yminorgrids
\needsminorlooptrue
\fi
\def\axis@placecomputedtick##1[##2]{%
\draw[##2]
\ifcase\axis@tickposnum
(\axis@xcoordminTEX\axis@leftover, \axis@tmpa)
-- (\axis@xcoordminTEX+##1, \axis@tmpa)
\or
(\axis@xcoordmaxTEX\axis@rightover, \axis@tmpa)
-- (\axis@xcoordmaxTEX-##1, \axis@tmpa)
\or
(\axis@xcoordminTEX\axis@leftover, \axis@tmpa)
-- (\axis@xcoordminTEX+##1, \axis@tmpa)
(\axis@xcoordmaxTEX\axis@rightover, \axis@tmpa)
-- (\axis@xcoordmaxTEX-##1, \axis@tmpa)
\fi
;
}%
\def\placecomputedgridline[##1]{%
\draw[##1]
(\axis@xcoordminTEX\axis@leftover, \axis@tmpa)
-- (\axis@xcoordmaxTEX\axis@rightover, \axis@tmpa)
;
}%
\foreach \y in {#1} {
\pgfextracty{\axis@tmpa}{\pgfpointxy{0}{\y}}%
%
\ifdim\axis@tmpa<\axis@ycoordminTEX
\else
\ifdim\axis@tmpa>\axis@ycoordmaxTEX
\else
% Achsenbeschriftung:
\ifnum\axis@tickposnum=1
\node at
(\axis@xcoordmaxTEX\axis@leftover,\axis@tmpa)
[right,style=every tick label,style=every y tick label]
{\show@yticklabel\axisticknum\y};
\else
\node at
(\axis@xcoordminTEX\axis@leftover,\axis@tmpa)
[left,style=every tick label,style=every y tick label]
{\show@yticklabel\axisticknum\y};
\fi
\fi
\fi
\global\advance\axisticknum by1
\begin{scope}
\clip (\axis@xcoordminTEX\axis@leftover, \axis@ycoordminTEX\axis@leftover)
rectangle (\axis@xcoordmaxTEX\axis@rightover, \axis@ycoordmaxTEX\axis@rightover);
% Y-ticks left and/or right
% in log:
% log( i*10^k ) = log\i + k\log10 -> draw ticks for i=1..9
\ifneedsminorloop
\foreach \i in {1,...,9} {
% this code here is scoped inside of \foreach.
\pgfextracty{\axis@tmpb}{\pgfpointxy{0}{\logi\i}}%
\advance\axis@tmpa by\axis@tmpb
\ifaxis@yminorgrids
\placecomputedgridline[style=every axis grid,style=every minor grid]%
\fi
\ifaxis@yminorticks
\axis@placecomputedtick\axis@subtickwidth[style=every tick,style=every minor tick]%
\fi
}%
\fi
\ifaxis@ymajorgrids
\placecomputedgridline[style=every axis grid,style=every major grid]%
\fi
\ifaxis@ymajorticks
\axis@placecomputedtick\axis@tickwidth[style=every tick,style=every major tick]%
\fi
\end{scope}
}%
\fi
\endgroup
}
% X-Achsen und Achsenbeschriftung
% 1: Ticks
\newcommand{\axis@drawxaxis}[1]{%
\begingroup
\axisticknum=0
\newif\ifneedsminorloop
\edef\axis@TMP{#1}%
\ifx\axis@TMP\empty
\else
\ifaxis@xminorticks
\needsminorlooptrue
\fi
\ifaxis@xminorgrids
\needsminorlooptrue
\fi
\def\axis@placecomputedtick##1[##2]{%
\draw[##2]
\ifcase\axis@tickposnum
(\axis@tmpa, \axis@ycoordminTEX\axis@leftover)
-- (\axis@tmpa, \axis@ycoordminTEX+##1)
\or
(\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover)
-- (\axis@tmpa, \axis@ycoordmaxTEX-##1)
\or
(\axis@tmpa, \axis@ycoordminTEX\axis@leftover)
-- (\axis@tmpa, \axis@ycoordminTEX+##1)
(\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover)
-- (\axis@tmpa, \axis@ycoordmaxTEX-##1)
\fi
;
}%
\def\placecomputedgridline[##1]{%
\draw[##1]
(\axis@tmpa, \axis@ycoordminTEX\axis@leftover)
-- (\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover)
;
}%
\foreach \x in {#1} {
\pgfextractx{\axis@tmpa}{\pgfpointxy{\x}{0}}%
%
\ifdim\axis@tmpa<\axis@xcoordminTEX
\else
\ifdim\axis@tmpa>\axis@xcoordmaxTEX
\else
% Achsenbeschriftung:
\ifnum\axis@tickposnum=1
\node at
(\axis@tmpa,\axis@ycoordmaxTEX\axis@leftover)
[above,style=every tick label,style=every x tick label]
{\show@xticklabel\axisticknum\x};
\else
\node at
(\axis@tmpa,\axis@ycoordminTEX\axis@leftover)
[below,style=every tick label,style=every x tick label]
{\show@xticklabel\axisticknum\x};
\fi
\fi
\fi
\global\advance\axisticknum by1
%
\begin{scope}
\clip (\axis@xcoordminTEX\axis@leftover, \axis@ycoordminTEX\axis@leftover)
rectangle (\axis@xcoordmaxTEX\axis@rightover, \axis@ycoordmaxTEX\axis@rightover);
% X-Axis ticks bottom and top
% in log:
% log( i*10^k ) = log\i + k\log10 -> draw ticks for i=1..9
\ifneedsminorloop
\foreach \i in {1,...,9} {
\pgfextractx{\axis@tmpb}{\pgfpointxy{\logi\i}{0}}%
\advance\axis@tmpa by\axis@tmpb
\ifaxis@xminorgrids
\placecomputedgridline[style=every axis grid,style=every minor grid]%
\fi
\ifaxis@xminorticks
\axis@placecomputedtick\axis@subtickwidth[style=every tick,style=every minor tick]%
\fi
}%
\fi
\ifaxis@xmajorgrids
\placecomputedgridline[style=every axis grid,style=every major grid]%
\fi
\ifaxis@xmajorticks
\axis@placecomputedtick\axis@tickwidth[style=every tick,style=every major tick]%
\fi
\end{scope}
}%
\fi
\endgroup
}
\def\axis@rememberplotspec#1{{%
\globaldefs=1
\listpushback#1\to\axis@plotspeclist
\advance\axis@numplots by1%
}}
\def\axis@getautoplotspec into#1{%
\listsize\autoplotspeclist\to\c@pgf@counta
\ifnum\c@pgf@counta=0
\let#1=\empty
\else
\c@pgf@countb=\axis@numplots
\loop
\ifnum\c@pgf@countb<\c@pgf@counta
\else
\advance\c@pgf@countb by-\c@pgf@counta
\repeat
\listselect\c@pgf@countb\of\autoplotspeclist\to#1
%\message{pgfplots.sty: using \string\autoplotspeclist\ specification no\#\the\c@pgf@countb (of \the\c@pgf@counta): #1}%
\fi
}
% The main interface to draw a plot into an axis.
%
% Usage:
% \addplot
% plot coordinates {
% (0,0)
% (1,1)
% };
%
% or
%
% \addplot[color=blue,mark=*]
% plot coordinates {
% (0,0)
% (1,1)
% };
%
% The first syntax will use the next plot specification in the list
% \autoplotspeclist
% and the first will use blue color and * markers.
%
% The linespec. will be used in the legend.
\long\def\addplot{%
\@ifnextchar+{%
\axis@getautoplotspec into\nextplotspec
\axis@addplotimplAPPEND
}{%
\@ifnextchar[{%
\axis@addplotimpl%
}{%
\axis@getautoplotspec into\nextplotspec
% the space after ']' is required here:
% FIXME:
% - \addplot[]plot coordinates is NOT allowed!?
\expandafter\axis@addplotimpl\expandafter[\nextplotspec]
}%
}%
}
\long\def\axis@addplotimplAPPEND+[{%
\expandafter\axis@addplotimpl\expandafter[\nextplotspec,
}
\long\def\axis@addplotimpl[#1] #2;{%
%\tracingmacros=2\tracingcommands=2
% #2 = plot coordinates {...}
\ifx\csname axis@execute at begin plot\endcsname\empty
\else
\csname axis@execute at begin plot\endcsname
\fi
\axis@rememberplotspec{[#1]}%
\ifaxis@filtercoords
% FIXME : FREE THIS VARIABLE:
\axis@filtercoords@and@up@limits#2;\newplotcmdto\axis@filteredcoordinateplotcmd
\def\axis@TMP{\axispath@impl{\draw[style=every axis plot,#1]}}%
\expandafter\axis@TMP\axis@filteredcoordinateplotcmd%
\else
\ifaxis@draw@at@end
\axis@update@limits{#2;}%
\fi
\axispath@impl{\draw[style=every axis plot,#1]}#2;%
\fi
\ifx\csname axis@execute at end plot\endcsname\empty
\else
\csname axis@execute at end plot\endcsname
\fi
%\tracingmacros=0\tracingcommands=0
}%
\long\def\axis@update@limits#1{%
\axis@foreach@plot@coord@do%
\axis@update@limits@for@one@point
\for
#1%
\EOI
}
% PRECONDITIONS:
% - 'floating point numerics active'
% => coordinate filtering is active
% => #1 and #2 are MACRO names
% => these macros are encoded with \scisetcomponents
% - no coordinate filters active
% => #1 and #2 MAY be macros, but they must be valid TeX
% length (without unit).
\long\def\axis@update@limits@for@one@point#1#2{%
%\tracingmacros=2\tracingcommands=2
%\message{Updating limits for (#1,#2) ...}%
\ifaxis@autocompute@xlim
\ifaxis@float@numerics@mode@x
%\scitofixedsingle\axis@xmin\axis@TMP
%\scitofixedsingle\axis@xmax\axis@TMPB
%\message{current limits: xmin=\axis@TMP, xmax=\axis@TMPB}%
\scigetcomponents#1\axis@tmp@S\axis@tmp@M\axis@tmp@E
\scigetcomponents\axis@xmin\axis@lim@S\axis@lim@M\axis@lim@E
\scimathmin%
\axis@lim@S\axis@lim@M\axis@lim@E
\and%
\axis@tmp@S\axis@tmp@M\axis@tmp@E
\to%
\axis@lim@S\axis@lim@M\axis@lim@E
\scisetcomponents\axis@xmin\axis@lim@S\axis@lim@M\axis@lim@E
%
\scigetcomponents\axis@xmax\axis@lim@S\axis@lim@M\axis@lim@E
\scimathmax%
\axis@lim@S\axis@lim@M\axis@lim@E
\and%
\axis@tmp@S\axis@tmp@M\axis@tmp@E
\to%
\axis@lim@S\axis@lim@M\axis@lim@E
\scisetcomponents\axis@xmax\axis@lim@S\axis@lim@M\axis@lim@E
%\scitofixedsingle\axis@xmin\axis@TMP
%\scitofixedsingle\axis@xmax\axis@TMPB
%\message{updated limits: xmin=\axis@TMP, xmax=\axis@TMPB}%
\else
\pgfmathmin{\axis@xmin}{#1}%
\let\axis@xmin=\pgfmathresult
\pgfmathmax{\axis@xmax}{#1}%
\let\axis@xmax=\pgfmathresult
\fi
\fi
\ifaxis@autocompute@ylim
\ifaxis@float@numerics@mode@y
%\scitofixedsingle\axis@ymin\axis@TMP
%\scitofixedsingle\axis@ymax\axis@TMPB
%\message{current limits: ymin=\axis@TMP, ymax=\axis@TMPB}%
\scigetcomponents#2\axis@tmp@S\axis@tmp@M\axis@tmp@E
\scigetcomponents\axis@ymin\axis@lim@S\axis@lim@M\axis@lim@E
\scimathmin%
\axis@lim@S\axis@lim@M\axis@lim@E
\and%
\axis@tmp@S\axis@tmp@M\axis@tmp@E
\to%
\axis@lim@S\axis@lim@M\axis@lim@E
\scisetcomponents\axis@ymin\axis@lim@S\axis@lim@M\axis@lim@E
%
\scigetcomponents\axis@ymax\axis@lim@S\axis@lim@M\axis@lim@E
\scimathmax%
\axis@lim@S\axis@lim@M\axis@lim@E
\and%
\axis@tmp@S\axis@tmp@M\axis@tmp@E
\to%
\axis@lim@S\axis@lim@M\axis@lim@E
\scisetcomponents\axis@ymax\axis@lim@S\axis@lim@M\axis@lim@E
%\scitofixedsingle\axis@ymin\axis@TMP
%\scitofixedsingle\axis@ymax\axis@TMPB
%\message{updated limits: ymin=\axis@TMP, ymax=\axis@TMPB}%
\else
\pgfmathmin{\axis@ymin}{#2}%
\let\axis@ymin=\pgfmathresult
\pgfmathmax{\axis@ymax}{#2}%
\let\axis@ymax=\pgfmathresult
\fi
\fi
\axis@limits@are@computedtrue
%\tracingmacros=0\tracingcommands=0
}
% Filters coordinates and writes a new, modified 'plot coordinates'
% command to macro #2.
\long\def\axis@filtercoords@and@up@limits#1\newplotcmdto#2{%
\let#2=\empty
\let\axis@filter@output=#2
\axis@foreach@plot@coord@do%
\axis@filter@one@coord@pair
\for
#1%
\EOI
\edef#2{plot coordinates {\axis@filter@output};}%
}%
\def\axis@filter@one@coord@pair#1#2{%
\ifx\axis@xfilter\empty
\def\axis@filter@tmp@x{#1}%
\else
\let\axis@filter@tmp@x=\empty
\axis@xfilter#1\to\axis@filter@tmp@x
\fi
\ifx\axis@yfilter\empty
\def\axis@filter@tmp@y{#2}%
\else
\let\axis@filter@tmp@y=\empty
\axis@yfilter#2\to\axis@filter@tmp@y
\fi
\ifx\axis@filter@tmp@x\empty
\message{NOTE: coordinate (#1,#2) has been dropped because of the x-coordinate filter.}%
\else
\ifx\axis@filter@tmp@y\empty
\message{NOTE: coordinate (#1,#2) has been dropped because of the y-coordinate filter.}%
\else
\ifaxis@draw@at@end
% update also axis limits:
\axis@update@limits@for@one@point{\axis@filter@tmp@x}{\axis@filter@tmp@y}%
\else
% apply data transformation directly.
\ifaxis@float@numerics@mode@x
\axis@datascaletrafo@x\axis@filter@tmp@x\to\axis@filter@tmp@x
\fi
\ifaxis@float@numerics@mode@y
\axis@datascaletrafo@y\axis@filter@tmp@y\to\axis@filter@tmp@y
\fi
\fi
% remind:
% \the\tokenregister
% will yield the contents of the token register, it will
% NOT expand recursively (like \expandafter)!
%
% Employ that here to maintain macros inside of
% \axis@filter@tmp[xy]
% (macros inside of those things are used by the floating
% point numerics to scale input data to TeX-lengths)
\pgfplots@toka=\expandafter{\axis@filter@output}%
\TOKL@ta=\expandafter{\axis@filter@tmp@x}%
\TOKL@tb=\expandafter{\axis@filter@tmp@y}%
\edef\axis@filter@output{\the\pgfplots@toka (\the\TOKL@ta,\the\TOKL@tb)}%
%\message{FILTERING: appended \axis@filter@tmp@x,\axis@filter@tmp@y}% -> results in \axis@filter@output}%
\fi
\fi
}
% A looping command to loop through plot coordinates.
% For every point, #3{X}{Y} will be invoked.
%
% No scoping is used during this operation, so you can access outer
% variables.
\long\def\axis@foreach@plot@coord@do#1\for plot coordinates #2;\EOI{%
\axis@foreach@plot@coord@ITERATE#1\n#2\EOI%
}
\def\axis@foreach@plot@coord@ITERATE#1\n{%
\@ifnextchar;{%
\axis@foreach@plot@coord@FINISH@SEMICOLON%
}{%
\@ifnextchar\EOI{%
\axis@foreach@plot@coord@FINISH%
}{%
\axis@foreach@plot@coord@NEXT#1\n%
}%
}%
}
\def\axis@foreach@plot@coord@NEXT#1\n(#2,#3){%
#1{#2}{#3}%
\axis@foreach@plot@coord@ITERATE#1\n
}
\def\axis@foreach@plot@coord@FINISH\EOI{}
\def\axis@foreach@plot@coord@FINISH@SEMICOLON;\EOI{}
% INPUT:
% a sequence of points (SMeE,SMeE) (terminated with ';')
% where S=sign, M=mantisse, E = exponent.
% Such input is generated in the case axis@float@numerics@modetrue
% by the coordinate filters.
% OUTPUT:
% proper sequence of fixed point coordinates which are the result of the
% data scaling transformation (\axis@datascaletrafo@x).
%
% The output will be written into the macro #1.
\long\def\axis@apply@data@scaletrafo@to@plot@data#1\to#2{%
\let#2=\empty
\let\axis@data@scaletrafo@result=\empty
\axis@foreach@plot@coord@do
\axis@apply@data@scaletrafo@to@one@point
\for
#1%
\EOI
\edef#2{plot coordinates {\axis@data@scaletrafo@result};}%
%\axis@apply@data@scaletrafo@to@plot@data@ITERATE\to#2 #1;%
}
\def\axis@apply@data@scaletrafo@to@one@point#1#2{%
\ifaxis@float@numerics@mode@x
\axis@decode@filtered@float@numerics#1\to\axis@filter@tmp@x
\axis@datascaletrafo@x\axis@filter@tmp@x\to\axis@filter@tmp@x
\else
\def\axis@filter@tmp@x{#1}%
\fi
\ifaxis@float@numerics@mode@y
\axis@decode@filtered@float@numerics#2\to\axis@filter@tmp@y
\axis@datascaletrafo@y\axis@filter@tmp@y\to\axis@filter@tmp@y
\else
\def\axis@filter@tmp@y{#2}%
\fi
\edef\axis@data@scaletrafo@result{\axis@data@scaletrafo@result (\axis@filter@tmp@x,\axis@filter@tmp@y)}%
}
\def\axis@decode@filtered@float@numerics#1#2e#3\to#4{%
\scisetcomponents#4{#1}{#2}{#3}%
}
\long\def\axispath#1;{%
\axispath@impl{}#1;
}
% low-level \axispath implementation.
% #1:
% the command which is responsable for drawing.
% - If #1 is NOT '\empty', we expect #2 to contain only
% EXPANDABLE DATA.
% That's important for postponed floating point arithmetics in #2.
% - If #1='\empty', we don't make any assumption about #2
% and process it as-is.
%
% #2: see above.
\long\def\axispath@impl#1#2;{%
\ifaxis@draw@at@end
\listpushback{#1}\to\axis@stored@plot@cmds
\listpushback{#2;}\to\axis@stored@plot@data
\else
#1#2;%
\fi
}
% Assigns a legend.
% Syntax:
% \legend{entry 1\\entry2\\entry3}
\newcommand{\legend}[2][]{
{%
\globaldefs=1% this will ONLY store the options and the legend into global variables
\def\axis@TMP{#1}%
\ifx\axis@TMP\empty
\else
\errmessage{Sorry, legend are now deprecated. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}%
\fi
\def\axis@TMP{#2}%
\ifx\axis@TMP\empty
\else
\listnew\axis@legend{#2}%
\fi
}
}
\newcommand{\addlegendentry}[1]{%
{%
\globaldefs=1% this will ONLY store the options and the legend into global variables
\listpushback#1\to\axis@legend
}%
}
\def\axis@pop@next@legend{{%
\globaldefs=1
\listcheckempty\axis@plotspeclist
\iflistempty
\let\axis@curplotlist=\empty
\else
\listpopfront\axis@plotspeclist\to\axis@curplotlist
\fi
%
\listcheckempty\axis@legend
\iflistempty
\let\axis@curlegend=\empty
\else
\listpopfront\axis@legend\to\axis@curlegend
\fi
\advance\axis@numplots by-1
}}
\long\def\axis@show@small@legendplots#1{
\draw#1
[mark repeat=2,mark phase=2]
plot coordinates {
(0cm,0cm)
(0.3cm,0cm)
(0.6cm,0cm)%
};%
}
% Typesets a legend node.
%
% It will either typeset a previously computed legend (which needs to be
% stored in the macro \axis@already@computed@legend@node)
%
% or it creates a legend, stores the commands into the macro named
% above and typesets it.
\newcommand\axis@createlegend{%
\ifx\axis@already@computed@legend@node\empty
\listcheckempty\axis@legend
\iflistempty
\else
%
%
\begingroup
% assemble a
% \matrix {
% small plot & legend1\\
% small plot & legend2\\
% ...
% };
% command [and using the 'legend columns' option]
%
% \TOKL@ta={
% small plot & legend1\\
% small plot & legend2\\
% ...
% }
% ( I have allocated the token register in my simplelist.sty)
%
% \global\def\axis@TMP{
% \matrix {
% \TOKL@TA
% };
% }
% -> finally, \axis@TMP will contain the complete command.
\TOKL@ta={}%
\let\curcolumnNum=\c@pgf@counta
\let\maxcolumnCount=\c@pgf@countb
\let\legendplotpos=\c@pgf@countc
\legendplotpos\expandafter=\axis@legend@plot@pos
\curcolumnNum=0
\maxcolumnCount\expandafter=\csname axis@legend columns\endcsname\relax
%
\loop
\ifnum0<\axis@numplots\relax
\axis@pop@next@legend
\ifx\axis@curlegend\empty
\else
\advance\curcolumnNum by1
\edef\axis@TMP{%
\the\TOKL@ta
\ifcase\legendplotpos
% legend plot pos=left
\noexpand\axis@show@small@legendplots{\axis@curplotlist}%
\noexpand\pgfmatrixnextcell
\noexpand\node {\axis@curlegend};
\or
% legend plot pos=right
\noexpand\node {\axis@curlegend};
\noexpand\pgfmatrixnextcell
\noexpand\axis@show@small@legendplots{\axis@curplotlist}%
\or
% legend plot pos=none
\noexpand\node {\axis@curlegend};
\fi
\ifnum\curcolumnNum=\maxcolumnCount
\noexpand\\
\else
\ifnum\axis@numplots=0
\noexpand\\
\else
\noexpand\pgfmatrixnextcell
\fi
\fi
}%
\ifnum\curcolumnNum=\maxcolumnCount
\curcolumnNum=0
\fi
\expandafter\TOKL@ta\expandafter{\axis@TMP}%
\fi
\repeat
\TOKL@tb={\matrix[style=every axis legend]}%
\xdef\axis@TMP{%
\the\TOKL@tb {%
\the\TOKL@ta
};%
}%
\endgroup
\let\axis@already@computed@legend@node=\axis@TMP
\fi
\fi
\axis@already@computed@legend@node
}
% Checks whether the argument to xtick or ytick is a UNIFORM tick
% sequence.
%
% A uniform tick sequence is 0,...,10 and 3,4,5 and -5,-4,-2 but
% NOT 0,2,4 or 4,10.
%
% Furthermore, any NON-integer tick arguments are also assumed to be
% NOT uniform.
%
% INPUT:
% #1: a tick argument (i.e. something which can be put to
% \foreach \x in {#1})
%
% OUTPUT:
% \axis@isuniformticktrue
% or
% \axis@isuniformtickfalse
% depending on the check.
% This variable will be set globally.
\def\axis@checkisuniformLOGtick#1{%
\begingroup
\global\axis@isuniformticktrue
\newif\ifisfirst
\newif\iftwo@are@equal
\isfirsttrue
\foreach \x in {#1}{%
\pgfmathmultiply@\x\reciproc@logten
\let\cur=\pgfmathresult
% check whether
% \cur - last == 1 (last = \axis@TMPB)
\ifisfirst
\global\isfirstfalse
\else
\pgfmathsubtract@\cur\axis@TMPB%
\pgfmathlog@approxequalto@macro\pgfmathresult{1.0}{two@are@equal}%
\iftwo@are@equal
\else
\global\axis@isuniformtickfalse
\breakforeach
\fi
\fi
\global\let\axis@TMPB=\cur
}%
\endgroup
}
\def\skipsuffixzero#1.#2|{
{%
\def\axis@TMP{#2}%
\def\axis@TMPB{0}%
\ifx\axis@TMP\axis@TMPB
\global\def\pgfmathresult{#1}%
\else
\global\def\pgfmathresult{#1.#2}%
\fi
}%
}
\def\logtologtentomacro#1#2{%
\pgfmathmultiply@{#1}\reciproc@logten%
\expandafter\skipsuffixzero\pgfmathresult|%
\let#2=\pgfmathresult
}
% Expands to #1/log(10). It will also skip a suffix '.0'
\def\logtologten#1{%
\pgfmathmultiply@{#1}\reciproc@logten%
\expandafter\skipsuffixzero\pgfmathresult|%
\pgfmathresult
}
% helper method which computes log10*\x foreach \x in {#1}.
% The result will be \xdef'ed into #2.
\def\axis@compute@tick@times@logten#1\to#2{%
\global\let#2=\empty
\foreach \axis@TMPB in {#1} {%
\pgfmathmultiply@\axis@TMPB\logten%
\ifx#2\empty
\xdef#2{\pgfmathresult}%
\else
\xdef#2{#2,\pgfmathresult}%
\fi
}%
}
\def\axis@init@enlarge@limit@booleans{%
\axis@enlargelimits@autofalse
\axis@enlargelimitsfalse
\axis@enlargelimits@rel@threshfalse
\edef\axis@TMP{\axis@enlargelimits}%
%
\def\axis@TMPB{true}%
\ifx\axis@TMP\axis@TMPB
\axis@enlargelimitstrue
\else
\def\axis@TMPB{false}%
\ifx\axis@TMP\axis@TMPB
\else
\def\axis@TMPB{auto}%
\ifx\axis@TMP\axis@TMPB
\axis@enlargelimits@autotrue
\else
\begingroup
% try to read it as number:
\expandafter\pgf@xa\axis@enlargelimits pt\relax
\endgroup
\axis@enlargelimitstrue
\axis@enlargelimits@rel@threshtrue
\fi
\fi
\fi
}
\def\axis@enlarge@limit@for#1{%
\begingroup
\expandafter\let\expandafter\min\expandafter=\csname axis@#1min\endcsname
\expandafter\let\expandafter\max\expandafter=\csname axis@#1max\endcsname
\ifcase\csname axis@#1mode\endcsname
\ifaxis@enlargelimits@rel@thresh
\edef\enlargepercent{\axis@enlargelimits}%
\else
\def\enlargepercent{0.1}% FIXME : pack 10% as default into option 'enlargelimits' or so
\fi
\pgfmathsubtract@\max\min%
\expandafter\pgf@xa\pgfmathresult pt
\expandafter\pgf@xb\enlargepercent\pgf@xa
\ifdim\pgf@xb>0.001pt
% the case with
% enlargeabsolute ~= 0
% means that \min ~= \max.
% It is handled in another method.
\edef\enlargeabsolute{\pgf@sys@tonumber{\pgf@xb}}%
%
% compute xmin := xmin - enlargeabsolute
\pgfmathsubtract@\min\enlargeabsolute%
\let\min=\pgfmathresult
\pgfmathadd@\max\enlargeabsolute%
\let\max=\pgfmathresult
\fi
\or
% compute
% \pgfmathsetmacro{\min}{\min - 0.5*\logten}%
% \pgfmathsetmacro{\max}{\max + 0.5*\logten}%
% just a more efficiently (I hope so):
\expandafter\pgfmath@x\logten pt
\divide\pgfmath@x by2
\pgfmathlog@invoke@expanded\pgfmathsubtract@{{\min}{\pgf@sys@tonumber{\pgfmath@x}}}%
\let\min=\pgfmathresult
\pgfmathlog@invoke@expanded\pgfmathadd@{{\max}{\pgf@sys@tonumber{\pgfmath@x}}}%
\let\max=\pgfmathresult
\fi
\xdef\axis@TMP{\min}%
\xdef\axis@TMPB{\max}%
\endgroup
\expandafter\let\csname axis@#1min\endcsname=\axis@TMP
\expandafter\let\csname axis@#1max\endcsname=\axis@TMPB
}
% Computes tick positions using the current axis limits.
%
% Parameters:
% \axisdefaulttickwidth
% Determines the maximum space which is not filled by at least one
% tick label (approximate, there is some rounding internally)
% \axisdefaulttryminticks
% see manual
%
% Idea:
% We want ticks at each
% { i*H, i in \Z }.
% Of course, there shouldn't be TOO MUCH ticks.
%
% Our heuristics is to set
% desirednumticks = round(ACTUAL WIDTH / axisdefaulttickwidth)
% and generate H = (axis range) / desirednumticks.
%
% Since not all step sizes H look well, restrict H to a set of allowed
% step sizes such as
% { 1, 1/2, 1/5, 1/10 },
% or, to be more precise:
% { 1*10^e, 2*10^e, 5*10^e }
% -> round to the nearest matching number!
%
% Then, the resulting tick is
% TICK={MIN,MIN+H,...,MAX}
% where
% MIN = I*H
% is chosen such that
% axis minimum limit = I*H + rest; |rest| < H.
%
%
% PRECONDITION:
% - limits are correct
% - axis width/height is set correctly
%
% POSTCONDITION:
% - Tick for axis #1 is assigned
% - \ifaxis@needs@check@uniformtick is set
\def\axis@assign@default@tick@foraxis#1{%
\begingroup
% Shortcut-names:
\expandafter\let\expandafter\ifaxis@is@datascaled\csname ifaxis@float@numerics@mode@#1\endcsname
\expandafter\let\expandafter\axis@data@scale@trafo\csname axis@datascaletrafo@#1\endcsname
\expandafter\let\expandafter\axis@data@scale@inverse@trafo\csname axis@inverse@datascaletrafo@#1\endcsname
%
\let\desirednumticks=\c@pgf@countd
\let\Wr=\pgf@xc
\Wr=\csname axis@#1coordmaxTEX\endcsname
\advance\Wr by-\csname axis@#1coordminTEX\endcsname
% r = max place without ticks in pt -> choose desirednumticks >= W/r
\expandafter\expandafter\divide\Wr\axisdefaulttickwidth
\pgfmathsetcount{\desirednumticks}{\Wr}%
\advance\desirednumticks by1
\expandafter\ifnum\axisdefaulttryminticks>\desirednumticks
\expandafter\desirednumticks\axisdefaulttryminticks
\fi
\ifcase\csname axis@#1mode\endcsname
% compute tick := MIN,MIN+H,....,MAX
\let\MINH=\pgf@xa
\let\H=\pgf@xb
\let\MAX=\axis@tmpa
\let\MIN=\axis@tmpb
% compute step size 'H':
\expandafter\MAX\csname axis@#1max\endcsname pt
\advance\MAX by0.001pt% avoid round errors
%\expandafter\MIN\the\c@pgf@counta pt
\expandafter\MIN\csname axis@#1min\endcsname pt
\H=\MAX
\advance\H by-\MIN
\c@pgf@counta=\desirednumticks
\advance\c@pgf@counta by-1
\divide\H by\c@pgf@counta
%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H=(axis range/(desirednumticks-1)) = \the\H}%
%
% SEARCH for the NEXT FEASABLE H.
%
\edef\Hmacro{\pgf@sys@tonumber\H}%
\ifaxis@is@datascaled
\expandafter\axis@data@scale@inverse@trafo\Hmacro\to\Hmacro
\else
\expandafter\sciparsesignsingle\expandafter{\Hmacro}\Hmacro
\fi
\scigetcomponents\Hmacro\H@S\H@M\H@E
%\message{Got T^{-1}(H) = [\H@S] \H@M * 10^\H@E}%
% modify the mantisse:
\expandafter\H\H@M pt
\ifdim\H<2pt
\ifdim\H<1.5pt
\def\H@M{1.0}%
\else
\def\H@M{2.0}%
\fi
\else
\ifdim\H<4.9999pt
\ifdim\H<3.5pt
\def\H@M{2.0}%
\else
\def\H@M{5.0}%
\fi
\else
\ifdim\H<7.5pt
\def\H@M{5.0}%
\else
\def\H@M{1.0}%
\expandafter\c@pgf@counta\H@E
\advance\c@pgf@counta by1
\edef\H@E{\the\c@pgf@counta}%
\fi
\fi
\fi
\scisetcomponents\Hmacro\H@S\H@M\H@E
\ifaxis@is@datascaled
\axis@data@scale@trafo\Hmacro\to\Hmacro
\else
\scitofixedsingle\Hmacro\Hmacro
\fi
%\message{I have computed H=\Hmacro}%
\expandafter\H\Hmacro pt
%\message{final H=\the\H}%
%
% Now, we want to activate the Tick set {i*H, i in \Z}
% compute I such that
% xmin = I * H + rest; |rest| < H
% -> I = round(xmin/H)
% -> MIN = I * H
\pgfmathlog@invoke@expanded\pgfmathdivide@{%
{\pgf@sys@tonumber\MIN}%
{\pgf@sys@tonumber\H}%
}%
\pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}%
\ifdim\MIN<0pt
% the truncation rounds TOWARDS 0 which is not what I want.
\advance\c@pgf@counta by-1
\fi
\MIN=\H
\multiply\MIN by\c@pgf@counta
\MINH=\MIN
\advance\MINH by\H
\xdef\axis@TMP{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}%
\aftergroup\axis@needs@check@uniformtickfalse
\or
\expandafter\ifx\csname axis@#1tickten\endcsname\empty
% I want ticks at 10^k. So determine k_min and k_max.
%
% FIXME: optimize!
\pgfmathsetcount{\c@pgf@counta}{\csname axis@#1min\endcsname*\reciproc@logten-1}%
\pgfmathsetmacro{\tmp@min}{\c@pgf@counta*\logten}%
\pgfmathsetcount{\c@pgf@counta}{\csname axis@#1max\endcsname*\reciproc@logten}%
\pgfmathsetmacro{\tmp@max}{\c@pgf@counta*\logten}%
\pgfmathadd\tmp@min\logten%
\xdef\axis@TMP{\tmp@min,\pgfmathresult,...,\tmp@max}%
\aftergroup\axis@needs@check@uniformtickfalse
\else
\edef\axis@TMP{\csname axis@#1tickten\endcsname}%
\expandafter\axis@compute@tick@times@logten\axis@TMP\to\axis@TMP
\aftergroup\axis@needs@check@uniformticktrue
\fi
\fi
\endgroup
\expandafter\let\csname axis@#1tick\endcsname=\axis@TMP
%\message{pgfplots.sty: #1tick set to \csname axis@#1tick\endcsname [#1mode=\the\csname axis@#1mode\endcsname, #1min=\csname axis@#1min\endcsname, #1max=\csname axis@#1max\endcsname].}%
}
% Helper method for
% \axis@apply@data@scale@trafo@to@options@for
% #1: the ticks
% #2: the trafo macro name (the form taking three args)
% #3: the output macro name
\long\def\axis@apply@data@scale@trafo@to@user@ticks#1#2\to#3{%
\let#3=\empty
\foreach \axis@TMPB in {#1} {%
\expandafter\sciparsesign\expandafter{\axis@TMPB}\sci@S\sci@M\sci@E
#2\sci@S\sci@M\sci@E\to\axis@TMPB
\ifx#3\empty
\xdef#3{\axis@TMPB}%
\else
\xdef#3{#3,\axis@TMPB}%
\fi
}%
%
}%
% helper for \axis@apply@data@scale@trafo@to@options@for.
\def\axis@compute@number@order@for@trafo@isdimen#1\tocount#2{%
\edef\axis@TMP{\pgf@sys@tonumber{#1}}%
\expandafter\sciparsesign\expandafter{\axis@TMP}\S\M\E
\expandafter#2\E\relax
\advance#2 by1
}
% helper for \axis@apply@data@scale@trafo@to@options@for.
%
\def\axis@compute@number@order@for@trafo@isfloat#1\tocount#2{%
\scigetcomponents#1\S\M\E
\expandafter#2\E\relax
\advance#2 by1
}
% Initialises the data scale transformation and applies it to any
% user specified options.
%
% PRECONDITION:
% - all axis limits are available in float representation
% (i.e. with \scisetcomponents)
% - \axis@set@default@size@options has been called before
% POSTCONDITION:
% - the scaling transformation is set up,
% - all axis limits are transformed,
% - any user input (like ticks and tick labels)
% will reflect the changes.
\def\axis@apply@data@scale@trafo@to@options@for#1{%
% initialise data scale transformation
% T(x) = 10^{q-m} * x
%
\begingroup
\let\data@max@order=\c@pgf@counta
\let\data@cur@order=\c@pgf@countb
\let\data@dimen=\pgf@xa
\let\data@dimen@order=\c@pgf@countc
%
% Step 1: compute 'm', the data order
\expandafter\axis@compute@number@order@for@trafo@isfloat
\csname axis@#1min\endcsname
\tocount\data@cur@order
%
\data@max@order=\data@cur@order
%
\expandafter\axis@compute@number@order@for@trafo@isfloat
\csname axis@#1max\endcsname
\tocount\data@cur@order
%
\ifnum\data@cur@order>\data@max@order
\data@max@order=\data@cur@order
\fi
%
% Step 2: compute 'q', the #1-size of the axis.
\expandafter\ifx\csname axis@#1\endcsname\empty
% We have 'width' or 'height'.
%
% Use the order of these parameters.
\def\axis@TMP{#1}%
\def\axis@TMPB{x}%
\ifx\axis@TMP\axis@TMPB
\expandafter\data@dimen\axis@width\relax
\else
\def\axis@TMPB{y}%
\ifx\axis@TMP\axis@TMPB
\expandafter\data@dimen\axis@height\relax
\fi
\fi
\axis@compute@number@order@for@trafo@isdimen
\data@dimen
\tocount\data@dimen@order
% This here is to avoid inaccuracies in the final
% axis rectangle size, see \axis@initsizes:
\advance\data@dimen@order by-1
\else
% FIXME:
% we have either the 'x=1cm' or 'y=1cm' option!
% How should I initialise the trafo!?
\data@dimen@order=3
\fi
%
%\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }%
\advance\data@dimen@order by-\data@max@order
\xdef\axis@TMP{\the\data@dimen@order}%
\endgroup
%\message{Initialising the data scale transformation in direction #1 to \axis@TMP...}%
% COMPLETE INITIALISATION:
\ifaxis@EMERGENCY@FORCE@DATA@TRAFO@TO@IDENTITY
\message{WARNING: the automatic scaling of input data has been DISABLED to allow axispath commands [otherwise, axispath commands would not know of the pgfplots scalings - leading to wrong images). DISABLING THE DATA SCALING LIMITS THE DATA RANGE! I hope I can fix this issue as soon as possible. Please take a look at the manual for more information. If you get 'OVERFLOW' or 'UNDERFLOW' errors, you may need to disable the axispath.}%
\def\axis@TMP{0}%
\expandafter\let\csname axis@data@scale@trafo@SHIFT@#1\endcsname\axis@TMP
\else
\expandafter\let\csname axis@data@scale@trafo@SHIFT@#1\endcsname\axis@TMP
\fi
%
% ... and apply transformation to any user input
%
% Transform axis limits:
\expandafter\expandafter\csname axis@datascaletrafo@#1\endcsname\csname axis@#1min\endcsname\to\axis@TMP
\expandafter\let\csname axis@#1min\endcsname=\axis@TMP
%
\expandafter\expandafter\csname axis@datascaletrafo@#1\endcsname\csname axis@#1max\endcsname\to\axis@TMP
\expandafter\let\csname axis@#1max\endcsname=\axis@TMP
%
% Convert any user-specified ticks:
\edef\axis@TMP{\csname axis@#1tick\endcsname}%
% this here should also work with 'xtick=\empty', the "No tick" command.
\ifx\axis@TMP\empty
\else
%\message{Converting #1tick='\csname axis@#1tick\endcsname'}%
\pgfplots@toka=\expandafter{\csname axis@datascaletrafo@#1@three\endcsname}%
\edef\axis@TMP{{\csname axis@#1tick\endcsname}\the\pgfplots@toka}%
\expandafter\axis@apply@data@scale@trafo@to@user@ticks\axis@TMP\to\axis@TMPC
\expandafter\let\csname axis@#1tick\endcsname=\axis@TMPC
\fi
%
% Transform any explicit axis unit scalings:
\expandafter\ifx\csname axis@#1\endcsname\empty
\else
%\message{Converting #1 unit scale='\csname axis@#1\endcsname' ... }%
\expandafter\pgfmathparse\expandafter{\csname axis@#1\endcsname}%
\expandafter\expandafter\csname axis@inverse@datascaletrafo@tofixed@#1\endcsname\pgfmathresult\to\axis@TMP
\edef\axis@TMP{\axis@TMP pt}%
\expandafter\edef\csname axis@#1\endcsname{\axis@TMP}%
%\message{to #1='\csname axis@#1\endcsname'.}%
\fi
}
\def\axis@determinedefaultvalues{%
\ifx\axis@xmin\empty
\errmessage{Sorry, the argument 'xmin=NUM' is mandatory to draw axes }%
\def\axis@xmin{0}%
\fi
\ifx\axis@xmax\empty
\errmessage{Sorry, the argument 'xmax=NUM' is mandatory to draw axes }%
\def\axis@xmax{1}%
\fi
\ifx\axis@ymin\empty
\errmessage{Sorry, the argument 'ymin=NUM' is mandatory to draw axes }%
\def\axis@ymin{0}%
\fi
\ifx\axis@ymax\empty
\errmessage{Sorry, the argument 'ymax=NUM' is mandatory to draw axes }%
\def\axis@ymax{1}%
\fi
%
\axis@set@default@size@options
%
\ifaxis@float@numerics@mode@x
\axis@apply@data@scale@trafo@to@options@for x%
\fi
\ifaxis@float@numerics@mode@y
\axis@apply@data@scale@trafo@to@options@for y%
\fi
%
\ifnum\axis@xmode=0
\axis@xminorticksfalse
\fi
\ifnum\axis@ymode=0
\axis@yminorticksfalse
\fi
%
\axis@init@enlarge@limit@booleans
\ifaxis@enlargelimits
% relax the sizes.
%
% Idea: if the user chose his xmin,xmax tight to his data,
% this here will look better.
\axis@enlarge@limit@for x
\axis@enlarge@limit@for y
\else
\ifaxis@enlargelimits@auto
\ifaxis@hide
% there is no axis, so skip this enlargement (unless
% the user explizitly requests it)
\else
% FIXME : this here should be user-configurable!
\ifaxis@autocompute@xlim
\axis@enlarge@limit@for x
\fi
\ifaxis@autocompute@ylim
\axis@enlarge@limit@for y
\fi
\fi
\fi
\fi
%
\axis@avoid@empty@axis@range@for x%
\axis@avoid@empty@axis@range@for y%
%
\axis@initsizes
%
\newif\ifaxis@xisuniform
\newif\ifaxis@yisuniform
\axis@xisuniformtrue
\axis@yisuniformtrue
\newif\ifaxis@needs@check@uniformtick
\axis@needs@check@uniformticktrue
\ifx\axis@xtick\empty
\axis@assign@default@tick@foraxis{x}%
\fi
\ifaxis@needs@check@uniformtick
\ifnum\axis@xmode=1
\expandafter\axis@checkisuniformLOGtick\expandafter{\axis@xtick}%
\fi
\ifaxis@isuniformtick
\axis@xisuniformtrue
\else
\axis@xminorticksfalse
\axis@xisuniformfalse
\fi
\fi
%
%
%
\axis@needs@check@uniformticktrue
\ifx\axis@ytick\empty
\axis@assign@default@tick@foraxis{y}%
\fi
\ifaxis@needs@check@uniformtick
\ifnum\axis@ymode=1
\expandafter\axis@checkisuniformLOGtick\expandafter{\axis@ytick}%
\fi
\ifaxis@isuniformtick
\axis@yisuniformtrue
\else
\axis@yminorticksfalse
\axis@yisuniformfalse
\fi
\fi
\ifx\axis@xticklabel\empty
\ifcase\axis@xmode
\def\axis@xticklabel{\axisdefaultticklabel}%
\or
\def\axis@xticklabel{\axisdefaultticklabellog}%
\fi
\fi
\ifx\axis@yticklabel\empty
\ifcase\axis@ymode
\def\axis@yticklabel{\axisdefaultticklabel}%
\or
\def\axis@yticklabel{\axisdefaultticklabellog}%
%--------------------------------------------------
% \def\axis@yticklabel{%
% \pgfmathexp\tick
% \expandafter\skipsuffixzero\pgfmathresult|%
% $\pgfmathresult$}%
%--------------------------------------------------
\fi
\fi
}
% Helper method for initsizes.
%
% It computes a scaling such that \axis@width = SCALE * ACTUAL WIDTH.
%
% The actual width is
% c + x*(xmax-xmin)
% based on
% - x*xmax = \axis@xcoordmaxTEX
% - x*xmin = \axis@xcoordminTEX
% - c = estimated, a constant for the axis label/tick labels
%
% Arguments:
% #1: the output argument for the SCALE.
\def\axis@initsizes@getXscale\into#1{%
\expandafter\axis@tmpa\axis@width\relax
% EXPECTED WIDTH = X = \axis@width
% ACTUAL WIDTH = c + x * (xmax-xmin)
% where c is a CONSTANT (for the axis labels/tick labels).
% -> \axis@tmpXscale = (X - c) / (x *(xmax-xmin))
%
% \axis@tmpa := X-c:
\ifaxis@scale@only@axis
\else
\advance\axis@tmpa by-45pt% FIXME determine 'c' correctly!
\fi
\ifdim\axis@tmpa<0pt
\errmessage{Error: Plot width `\axis@width' is too small. This can't be realised while maintaining constant width for y-labels. Sorry, label width are only approximate. You will need to adjust your width.}%
\axis@tmpa=0pt
\fi
% \axis@tmpb := x*(xmax-xmin):
\axis@tmpb=\axis@xcoordmaxTEX
\advance\axis@tmpb by-\axis@xcoordminTEX
\pgfmathlog@invoke@expanded\pgfmathdivide@{%
{\pgf@sys@tonumber\axis@tmpa}%
{\pgf@sys@tonumber\axis@tmpb}%
}%
\let#1=\pgfmathresult
%\message{pgfplots.sty: Computing 'x' such that 'width = c + x*(xmax-xmin)';
% c=estimated,
% width-c =\the\axis@tmpa,
% x*(xmax[=\the\axis@xcoordmaxTEX] - xmin[=\the\axis@xcoordminTEX)]) = \the\axis@tmpb
% -> x-scale =#1 }%
}
% The same as \axis@initsizes@getXscale, just for the height.
\def\axis@initsizes@getYscale\into#1{%
\expandafter\axis@tmpa\axis@height\relax
% EXPECTED WIDTH = X = \axis@width
% ACTUAL WIDTH = c + x * (xmax-xmin)
% where c is a CONSTANT (for the axis labels/tick labels).
% -> \axis@tmpXscale = (X - c) / (x *(xmax-xmin))
%
% \axis@tmpa := X-c:
\ifaxis@scale@only@axis
\else
\advance\axis@tmpa by-45pt\relax% FIXME determine 'c' correctly!
\fi
\ifdim\axis@tmpa<0pt
\errmessage{Error: Plot height `\axis@height' is too small. This can't be realised while maintaining constant height for x-labels. Sorry, label heights are only approximate. You will need to adjust your height.}%
\axis@tmpa=0pt
\fi
% \axis@tmpb := x*(xmax-xmin):
\axis@tmpb=\axis@ycoordmaxTEX
\advance\axis@tmpb by-\axis@ycoordminTEX
\pgfmathlog@invoke@expanded\pgfmathdivide@{%
{\pgf@sys@tonumber\axis@tmpa}%
{\pgf@sys@tonumber\axis@tmpb}%
}%
\let#1=\pgfmathresult
%\message{pgfplots.sty: Computing 'y' such that 'height = c + y*(ymax-ymin)';
% height=\axis@height,
% c=estimated,
% height-c =\the\axis@tmpa,
% y*(ymax[=\the\axis@ycoordmaxTEX] - ymin[=\the\axis@ycoordminTEX)]) = \the\axis@tmpb
% -> y-scale =#1 }%
}
% Checks whether axis limits in coordinate #1 are approximately equal.
%
% If that is the case, force a non-zero width of the range.
%
\def\axis@avoid@empty@axis@range@for#1{%
% Check if axis limits are empty:
\begingroup
\expandafter\let\expandafter\if@cur@is@scaled\csname ifaxis@float@numerics@mode@#1\endcsname
\expandafter\let\expandafter\min\csname axis@#1min\endcsname
\expandafter\let\expandafter\max\csname axis@#1max\endcsname
\let\min@d=\pgf@xa
\let\max@d=\pgf@xb
\let\diff=\pgf@xc
\newif\ifrange@is@approx@equal
\expandafter\min@d\min pt
\expandafter\max@d\max pt
\diff=\max@d
\advance\diff by-\min@d
% FIXME : I need a RELATIVE check here!
% but: real number point division is expensive
\if@cur@is@scaled
% this here should be sufficient because the axis
% has absolute values of order O( 10^3 ) or so.
\ifdim\diff<1pt
\range@is@approx@equaltrue
\fi
\else
% there is no data scaling, so I should be much more defensive
% with absolute thresholds...
\ifdim\diff<0.05pt
\range@is@approx@equaltrue
\fi
\fi
\ifrange@is@approx@equal
%\message{avoid range is approx equal for coord #1: MODIFYING (\min,\max)...}%
% the case \min ~= \max
%
% enlarge \max and shrink \min:
\ifdim\max@d<0pt
\ifdim\max@d<-1pt
\max@d=0.8\max@d
\min@d=1.2\min@d
\else
\advance\max@d by-1pt
\advance\min@d by1pt
\fi
\else
\ifdim\max@d>1pt
\max@d=1.2\max@d
\min@d=0.8\min@d
\else
\ifdim\max@d=0pt
\if@cur@is@scaled
% we can't simply add a constant in the
% transformed range.
%
% So: set limits to [-1,1] = [-1.0e0,+1.0e0]
\def\sci@S{2}%
\def\sci@M{1.0}%
\def\sci@E{0}%
\csname axis@datascaletrafo@#1@three\endcsname\sci@S\sci@M\sci@E\to\min
\def\sci@S{1}%
\def\sci@M{1.0}%
\def\sci@E{0}%
\csname axis@datascaletrafo@#1@three\endcsname\sci@S\sci@M\sci@E\to\max
%\message{[trafo shift = \csname axis@data@scale@trafo@SHIFT@#1\endcsname; setting limits -1:1]}%
\expandafter\min@d\min pt
\expandafter\max@d\max pt
\else
\advance\max@d by1pt
\advance\min@d by-1pt
\fi
\else
\advance\max@d by1pt
\advance\min@d by-1pt
\fi
\fi
\fi
\xdef\axis@TMP{\pgf@sys@tonumber{\min@d}}%
\xdef\axis@TMPB{\pgf@sys@tonumber{\max@d}}%
%\message{ -> #1 = \axis@TMP : \axis@TMPB;}%
\else
\global\let\axis@TMP=\min%
\global\let\axis@TMPB=\max%
\fi
\endgroup
\expandafter\let\csname axis@#1min\endcsname=\axis@TMP
\expandafter\let\csname axis@#1max\endcsname=\axis@TMPB
}
% PRECONDITION:
% none
% POSTCONDITION:
% \axis@default@aspect@ratio is set.
\def\axis@compute@default@aspect@ratio{%
\expandafter\pgfmath@x\axisdefaultwidth
\expandafter\pgfmath@y\axisdefaultheight
\pgfmathlog@invoke@expanded\pgfmathdivide@{%
{\pgf@sys@tonumber{\pgfmath@x}}%
{\pgf@sys@tonumber{\pgfmath@y}}%
}%
\let\axis@default@aspect@ratio=\pgfmathresult
}
\def\axis@set@default@size@options{%
% The axes 'x' and 'y' vectors will be scaled such that the total
% size is (\axisdefaultwidth, \axisdefaultheight).
%
% If the user specifies ONE of width OR height,
% the plot will be resized; keeping the aspect ratio.
%
\let\axis@default@aspect@ratio=\empty
% CASES:
% hasx := 'x' option non-empty
% hasy := 'y' option non-empty
% W := 'width' option non-empty
% H := 'height' option non-empty
%
% hasx = 1 -> width is not interesting; we use 'x' option.
% hasx = 0 -> determine final width:
% W H
% 0 0 -> \axisdefaultwidth
% 0 1 -> determine width out of H and the default aspect ratio
% 1 X -> ok, use the user parameter.
%
% hasy = 1 -> height is not interesting, we use 'y' option.
% hasy = 0 -> determine final height:
% W H
% 0 0 -> \axisdefaultheight
% X 1 -> ok, use the user parameter
% 1 0 -> determine height out of W and the default aspect ratio
%
\ifx\axis@x\empty
\ifx\axis@y\empty
% hasx=0, hasy=0
%
% -> KEEP ASPECT RATIO if just one W, or H is given!
\ifx\axis@width\empty
\ifx\axis@height\empty
% The case hasx=0, hasy=0, W=0 H=0:
\let\axis@width=\axisdefaultwidth
\let\axis@height=\axisdefaultheight
\else
% The case hasx=0, hasy=0, W=0 H=1:
\axis@compute@default@aspect@ratio
\expandafter\pgfmath@y\axis@height
\pgfmathlog@invoke@expanded\pgfmathmultiply@{%
{\pgf@sys@tonumber{\pgfmath@y}}%
{\axis@default@aspect@ratio}%
}%
\edef\axis@width{\pgfmathresult pt}%
\fi
\else
\ifx\axis@height\empty
% The case hasx=0, hasy=0, W=1 H=0:
\axis@compute@default@aspect@ratio
\expandafter\pgfmath@x\axis@width
\pgfmathlog@invoke@expanded\pgfmathdivide@{%
{\pgf@sys@tonumber{\pgfmath@x}}%
{\axis@default@aspect@ratio}%
}%
\edef\axis@height{\pgfmathresult pt}%
\else
% The case hasx=0, hasy=0, W=1 H=1:
\fi
\fi
\else
% hasx=0, hasy=1, W=0:
\ifx\axis@width\empty
\let\axis@width=\axisdefaultwidth
\fi
\fi
\else
\ifx\axis@y\empty
% hasx=1, hasy=0, H=0
\ifx\axis@height\empty
\let\axis@height=\axisdefaultheight
\fi
\fi
\fi
}
% PRECONDITION:
% - final axis limits are given in transformed range
% - \axis@set@default@size@options has been invoked before
% POSTCONDITION:
% - the current x- and y unit vectors are changed;
% - \axis@[xy]coord{min,max}TEX are set
%
\def\axis@initsizes{%
% INIT.
%
%
\pgfpointxy{\axis@xmin}{\axis@ymin}%
\axis@xcoordminTEX=\pgf@x
\axis@ycoordminTEX=\pgf@y
\pgfpointxy{\axis@xmax}{\axis@ymax}%
\axis@xcoordmaxTEX=\pgf@x
\axis@ycoordmaxTEX=\pgf@y
%
%
%-----------------------------------------
% PROCESS THE 'width' and 'height' options
%-----------------------------------------
%
% FIXME: make these variables LOCAL:
%
\let\axis@rectangle@width=\empty
\let\axis@rectangle@height=\empty
%
\ifx\axis@x\empty
\ifx\axis@width\empty
\errmessage{INTERNAL LOGIC ERROR! WIDTH NOT SET}%
\fi
\axis@initsizes@getXscale\into\axis@tmpXscale
\ifaxis@scale@only@axis
\let\axis@rectangle@width=\axis@width
\fi
\else
\def\axis@tmpXscale{1}%
\fi
%
\ifx\axis@y\empty
\ifx\axis@height\empty
\errmessage{INTERNAL LOGIC ERROR! HEIGHT NOT SET}%
\fi
\axis@initsizes@getYscale\into\axis@tmpYscale
\ifaxis@scale@only@axis
\let\axis@rectangle@height=\axis@height
\fi
\else
\def\axis@tmpYscale{1}%
\fi
%
%
% assert( \axis@tmpXscale != \empty && \axis@tmpYscale != \empty )
%
% Apply scaling:
\pgfpointxy{\axis@tmpXscale}{\axis@tmpYscale}%
\axis@tmpa=\pgf@x
\axis@tmpb=\pgf@y
\ifx\axis@x\empty
\pgfsetxvec{\pgfpoint{\axis@tmpa}{0pt}}%
\else
\pgfsetxvec{\pgfpoint{\axis@x}{0pt}}%
\fi
\ifx\axis@y\empty
\pgfsetyvec{\pgfpoint{0pt}{\axis@tmpb}}%
\else
\pgfsetyvec{\pgfpoint{0pt}{\axis@y}}%
\fi
%
% Determine final rectangle dimensions.
% There are the following cases:
% 1. the user really wants a fixed dimension,
% i.e. he used 'scale only axis'.
% Then, we have to work to get the correct dimension!
%
% Up to now, the scaling mechanism looses to many significant
% digits such that the final width/height differs by 1-2 pt.
%
% If I am not mistaken, this does ONLY affect the final size,
% not the relative plot precision.
%
% FIXME : really compute the plot precision!
%
% 2. The use specified width and/or height, but not 'scale only
% axis'. Accept inaccurate final widths/heights (see above).
%
% 3. The user supplied 'x' and or 'y'. Simply use them, its
% accurate.
%
\pgfpointxy{\axis@xmin}{\axis@ymin}%
\axis@xcoordminTEX=\pgf@x
\axis@ycoordminTEX=\pgf@y
\pgfpointxy{\axis@xmax}{\axis@ymax}%
\ifx\axis@rectangle@width\empty
\axis@xcoordmaxTEX=\pgf@x
\else
% this 'if' here should only make a difference of about
% 1-2pt, not more.
%
% and I am quite sure that this inaccuracy (and this
% work-around) only affects the
% final size, not the relative plot accuracy.
\axis@xcoordmaxTEX=\axis@xcoordminTEX
\expandafter\advance\expandafter\axis@xcoordmaxTEX\axis@width
\fi
\ifx\axis@rectangle@height\empty
\axis@ycoordmaxTEX=\pgf@y
\else
\axis@ycoordmaxTEX=\axis@ycoordminTEX
\expandafter\advance\expandafter\axis@ycoordmaxTEX\axis@height
\fi
%--------------------------------------------------
% \begingroup
% \pgf@x=\axis@xcoordmaxTEX\advance\pgf@x by-\axis@xcoordminTEX
% \pgf@y=\axis@ycoordmaxTEX\advance\pgf@y by-\axis@ycoordminTEX
% \message{Axis scaling x=\axis@tmpXscale, y=\axis@tmpYscale\ yields lower-left-corner (\axis@xmin,\axis@ymin) = (\the\axis@xcoordminTEX,\the\axis@ycoordminTEX) and upper right (\axis@xmax,\axis@ymax) = (\the\axis@xcoordmaxTEX,\the\axis@ycoordmaxTEX). Axis dimensions are width=\the\pgf@x, height=\the\pgf@y.}%
% \endgroup
%--------------------------------------------------
}
\def\axis@BEGIN@init@and@draw@axis{%
\axis@determinedefaultvalues
% move the anchor to (0,0):
\expandafter\ifcase\axis@anchorchoicenum
% north:
\begin{scope}[
yshift=-\axis@ycoordmaxTEX,
xshift=-0.5\axis@xcoordminTEX-0.5\axis@xcoordmaxTEX
]
\or% north west:
\begin{scope}[
yshift=-\axis@ycoordmaxTEX,
xshift=-\axis@xcoordminTEX
]
\or% west:
\begin{scope}[
yshift=-0.5\axis@ycoordminTEX-0.5\axis@ycoordmaxTEX,
xshift=-\axis@xcoordminTEX
]
\or% south west:
\begin{scope}[
yshift=-\axis@ycoordminTEX,
xshift=-\axis@xcoordminTEX
]
\or% south:
\begin{scope}[
yshift=-\axis@ycoordminTEX,
xshift=-0.5\axis@xcoordminTEX-0.5\axis@xcoordmaxTEX
]
\or% south east:
\begin{scope}[
yshift=-\axis@ycoordminTEX,
xshift=-\axis@xcoordmaxTEX
]
\or% east:
\begin{scope}[
yshift=-0.5\axis@ycoordminTEX-0.5\axis@ycoordmaxTEX,
xshift=-\axis@xcoordmaxTEX
]
\or% north east:
\begin{scope}[
yshift=-\axis@ycoordmaxTEX,
xshift=-\axis@xcoordmaxTEX
]
\or% center
\begin{scope}[
yshift=-0.5\axis@ycoordminTEX-0.5\axis@ycoordmaxTEX,
xshift=-0.5\axis@xcoordminTEX-0.5\axis@xcoordmaxTEX
]
\fi
\begin{scope}
\ifaxis@hide
\clip
(\axis@xcoordminTEX, \axis@ycoordminTEX)
rectangle (\axis@xcoordmaxTEX, \axis@ycoordmaxTEX);
\else
% X-Achsenbeschriftung:
% LADE DIE \axis@xtick -variable REIN
\expandafter\axis@drawxaxis\expandafter{\axis@xtick}
%
% Y-Achsen und Achsenbeschriftung:
\expandafter\axis@drawyaxis\expandafter{\axis@ytick}%
\draw[clip]
(\axis@xcoordminTEX, \axis@ycoordminTEX)
rectangle (\axis@xcoordmaxTEX, \axis@ycoordmaxTEX);
\fi
}
\def\axis@END@init@and@draw@axis{%
\end{scope}%
}
% Writes output to \axis@TMP
\def\axis@filter@input@ticks@with@log#1{%
\let\axis@TMP=\empty
\foreach \axis@TMPB in {#1} {%
\expandafter\pgfmathlog@\expandafter{\axis@TMPB}%
\ifx\axis@TMP\empty
\xdef\axis@TMP{\pgfmathresult}%
\else
\xdef\axis@TMP{\axis@TMP,\pgfmathresult}%
\fi
}%
}
\tikzdeclarecoordinatesystem{axis}{\axis@evalute@tikz@coord@system@interface#1\axis@coord@end}
% Assigns \pgfmathresult := canvas coordinate (#2) for axis #1.
\long\def\axis@evalute@tikz@coord@system@interface@for#1#2{%
\expandafter\let\expandafter\if@datascaled@cur\csname ifaxis@float@numerics@mode@#1\endcsname
\expandafter\ifcase\csname axis@#1mode\endcsname
\if@datascaled@cur
\csname axis@datascaletrafo@fromfixed@#1\endcsname#2\to\pgfmathresult
\else
\def\pgfmathresult{#2}%
\fi
\or
\pgfmathlog@{#2}%
\fi
}
\long\def\axis@evalute@tikz@coord@system@interface#1,#2\axis@coord@end{%
\begingroup
\axis@evalute@tikz@coord@system@interface@for{x}{#1}%
\let\axis@evaluate@tikz@coord@x=\pgfmathresult
\axis@evalute@tikz@coord@system@interface@for{y}{#2}%
\xdef\axis@TMP{\axis@evaluate@tikz@coord@x pt}%
\xdef\axis@TMPB{\pgfmathresult pt}%
\endgroup
\pgfpointxy{\axis@TMP}{\axis@TMPB}%
}
% In case of (semi-) logplots, this command will
% - assign a filter which invokes \pgfmathlog@{} for each coordinate
% - replace any user-specified coordinate by its log.
%
% All subsequent commands will then work with logarithmic coordinates.
%
% @see pgfmathlog.sty for details about the implementation of log().
%
% PRECONDITION:
% - The user input options have been set correctly,
% - the option processing has not yet begun
%
% POSTCONDITION:
% - any user input for log-axis has been replaced by its log
% - coordinate filters to compute logs are installed
%
% See also:
% \axis@apply@data@scale@trafo@to@options@for
\def\axis@prepare@coord@filtering@for#1{%
\expandafter\ifcase\csname axis@#1mode\endcsname
\ifaxis@disabledatascaling
\csname axis@float@numerics@mode@#1false\endcsname
\axis@float@numerics@modefalse
\else
\csname axis@float@numerics@mode@#1true\endcsname
\axis@float@numerics@modetrue
\fi
\ifaxis@float@numerics@mode
% Install coordinate filters that
% - read input as normalised floating point numbers,
% - return [SIGN][MANTISSE]eEXPONENT
% Motivation:
% 1. we can compute axis limits using such data
% 2. we can remember the floating point representation for
% the data scaling transformation.
% ATTENTION:
% this here is a preprocessing step! You will need to
% apply the data scaling later!
% see
% \axis@apply@data@scaletrafo@to@plot@data
\expandafter\let\expandafter\axis@TMP\csname axis@#1filter\endcsname
\ifx\axis@TMP\empty
\expandafter\def\csname addplot@float@numerics@#1filter\endcsname##1\to##2{%
\sciparsesign{##1}\axis@tmp@S\axis@tmp@M\axis@tmp@E
\scisetcomponents{##2}\axis@tmp@S\axis@tmp@M\axis@tmp@E
\edef##2{\axis@tmp@S\axis@tmp@M e\axis@tmp@E}%
}%
\else
\expandafter\let\csname axis@#1filter@orig\endcsname=\axis@TMP
\expandafter\def\csname addplot@float@numerics@#1filter\endcsname##1\to##2{%
\csname axis@#1filter@orig\endcsname##1\to##2\relax
\ifx##2\empty
\else
\expandafter\sciparsesign\expandafter{##2}\axis@tmp@S\axis@tmp@M\axis@tmp@E
\scisetcomponents{##2}\axis@tmp@S\axis@tmp@M\axis@tmp@E
\edef##2{\axis@tmp@S\axis@tmp@M e\axis@tmp@E}%
\fi
}%
\fi
\expandafter\let\expandafter\axis@TMP\csname addplot@float@numerics@#1filter\endcsname
\expandafter\let\csname axis@#1filter\endcsname\axis@TMP
%
% Check for any existing axis limits:
\expandafter\let\expandafter\axis@TMP\csname axis@#1min\endcsname
\ifx\axis@TMP\empty
\else
\expandafter\sciparsesign\expandafter{\axis@TMP}\axis@tmp@S\axis@tmp@M\axis@tmp@E
\expandafter\scisetcomponents\csname axis@#1min\endcsname\axis@tmp@S\axis@tmp@M\axis@tmp@E
\fi
\expandafter\let\expandafter\axis@TMP\csname axis@#1max\endcsname
\ifx\axis@TMP\empty
\else
\expandafter\sciparsesign\expandafter{\axis@TMP}\axis@tmp@S\axis@tmp@M\axis@tmp@E
\expandafter\scisetcomponents\csname axis@#1max\endcsname\axis@tmp@S\axis@tmp@M\axis@tmp@E
\fi
\fi
\or
\ifaxis@disablelogfilter
\else
% any user-specified axis limits:
\expandafter\let\expandafter\axis@TMP\csname axis@#1min\endcsname
\ifx\axis@TMP\empty
\else
\expandafter\pgfmathlog@\expandafter{\axis@TMP}%
\expandafter\let\csname axis@#1min\endcsname=\pgfmathresult
\fi
\expandafter\let\expandafter\axis@TMP\csname axis@#1max\endcsname
\ifx\axis@TMP\empty
\else
\expandafter\pgfmathlog@\expandafter{\axis@TMP}%
\expandafter\let\csname axis@#1max\endcsname=\pgfmathresult
\fi
%
% any user specified axis ticks:
\expandafter\let\expandafter\axis@TMP\csname axis@#1tick\endcsname
\ifx\axis@TMP\empty
\else
\expandafter\axis@filter@input@ticks@with@log\expandafter{\axis@TMP}%
\expandafter\edef\csname axis@#1tick\endcsname{\axis@TMP}%
\fi
%
\expandafter\let\expandafter\axis@TMP\csname axis@#1filter\endcsname
\ifx\axis@TMP\empty
\expandafter\def\csname addplot@log@compute@#1filter\endcsname##1\to##2{%
\pgfmathlog@{##1}%
\let##2=\pgfmathresult
}%
\else
\expandafter\let\csname axis@#1filter@orig\endcsname=\axis@TMP
\expandafter\def\csname addplot@log@compute@#1filter\endcsname##1\to##2{%
\pgfmathlog@{##1}%
\ifx\pgfmathresult\empty
\let##2=\empty
\else
\expandafter\expandafter\csname axis@#1filter@orig\endcsname\pgfmathresult\to##2\relax
\fi
}%
\fi
\expandafter\let\expandafter\axis@TMP\csname addplot@log@compute@#1filter\endcsname
\expandafter\let\csname axis@#1filter\endcsname\axis@TMP
\fi
\fi
}
\def\axis@create@axis@descriptions{%
\ifaxis@hide
\else
\ifx\axis@xlabel\empty
\else
\axisshowxlabel
\fi
\ifx\axis@ylabel\empty
\else
\axisshowylabel
\fi
\fi
\ifx\axis@title\empty
\else
\axisshowtitle
\fi
\axis@createlegend
}
% DATA TRANSFORMATION T(x) = X
%
% Input:
% a number in the original data range, given in **floating** point representation
% Output:
% a fixed point number in transformed range
% @see
% \axis@datascaletrafo@x@three
% \axis@datascaletrafo@fromfixed@x
\def\axis@datascaletrafo@x#1\to#2{%
\scigetcomponents#1\axis@tmp@S\axis@tmp@M\axis@tmp@E
\axis@datascaletrafo@x@three\axis@tmp@S\axis@tmp@M\axis@tmp@E\to#2
}
% Overloaded function.
% Input:
% The same as above, but with Sign, Mantisse, Exponent.
% #1,#2 and #3 are expected to be MACRO NAMES.
\def\axis@datascaletrafo@x@three#1#2#3\to#4{%
\def\axis@TMP{\scimathshift{#1}{#2}{#3}}%
\expandafter\axis@TMP\expandafter{\axis@data@scale@trafo@SHIFT@x}%
\scitofixed{#1}{#2}{#3}{#4}%
}
% Overloaded function.
% Input:
% a FIXED point number instead of a floating point one.
% @see \axis@datascaletrafo@x
\def\axis@datascaletrafo@fromfixed@x#1\to#2{%
\begingroup
\sciparsesign{#1}\axis@S\axis@M\axis@E
\axis@datascaletrafo@x@three\axis@S\axis@M\axis@E\to{#2}%
\global\let\axis@TMP=#2\relax
\endgroup
\let#2=\axis@TMP
}
\def\axis@datascaletrafo@y#1\to#2{%
\scigetcomponents#1\axis@tmp@S\axis@tmp@M\axis@tmp@E
\axis@datascaletrafo@y@three\axis@tmp@S\axis@tmp@M\axis@tmp@E\to#2
}
\def\axis@datascaletrafo@y@three#1#2#3\to#4{%
\def\axis@TMP{\scimathshift{#1}{#2}{#3}}%
\expandafter\axis@TMP\expandafter{\axis@data@scale@trafo@SHIFT@y}%
\scitofixed{#1}{#2}{#3}{#4}%
}
\def\axis@datascaletrafo@fromfixed@y#1\to#2{%
\begingroup
\sciparsesign{#1}\axis@S\axis@M\axis@E
\axis@datascaletrafo@y@three\axis@S\axis@M\axis@E\to{#2}%
\global\let\axis@TMP=#2\relax
\endgroup
\let#2=\axis@TMP
}
% INVERSE transformation x = T^{-1}( X )
% Input:
% a fixed point number in transformed domain
% Output:
% a number in the data domain, given in floating point
% representation
\def\axis@inverse@datascaletrafo@x#1\to#2{%
\expandafter\sciparsesignsingle\expandafter{#1}#2
\edef\axis@TMP{\noexpand#2{-\axis@data@scale@trafo@SHIFT@x}}%
\expandafter\scimathshiftsingle\axis@TMP
}
\def\axis@inverse@datascaletrafo@y#1\to#2{%
\expandafter\sciparsesignsingle\expandafter{#1}#2
\edef\axis@TMP{\noexpand#2{-\axis@data@scale@trafo@SHIFT@y}}%
\expandafter\scimathshiftsingle\axis@TMP
}
% Overloaded function.
%
% In contrast to \axis@inverse@datascaletrafo@x, this method
% returns a number in FIXED point representation.
% @see \axis@inverse@datascaletrafo@x
\def\axis@inverse@datascaletrafo@tofixed@x#1\to#2{%
\axis@inverse@datascaletrafo@x#1\to{#2}%
\scitofixedsingle{#2}{#2}%
}
\def\axis@inverse@datascaletrafo@tofixed@y#1\to#2{%
\axis@inverse@datascaletrafo@y#1\to{#2}%
\scitofixedsingle{#2}{#2}%
}
\newenvironment{axis}[1][]{%
\begingroup
% \def\axis@setkeys{\setkeys*[\prefix]{axis}}%
%\tracingmacros=2\tracingcommands=2
% \message{Der every-axis-style ist gerade \csname tikz@st@every axis\endcsname}%
%\tracingmacros=0\tracingcommands=0
% \expandafter\expandafter\expandafter\axis@setkeys
% \expandafter\expandafter\expandafter{\csname tikz@st@every axis\endcsname}%
\begin{scope}[style=every axis,%
x=1pt,y=1pt% see below
]
% The explicit specification of 'x' and 'y' as 1pt is to avoid
% numeric overflow/underflow during scale computations:
%
% The scaling (i.e. proper values for 'x' and 'y') will be
% determined later-on, dependend on the axis limits. Since axis
% limits are implicitly in units of 1pt, it is reasonable to use
% '1pt' here as well.
%
%
%--------------------------------------------------
% \draw[very thin,color=gray,xstep=1,ystep=\logten]
% (\xcoordmin\axis@leftover,\ycoordmin)
% grid (\xcoordmax\axis@rightover,\ycoordmax);
%--------------------------------------------------
\setkeys[\prefix]{axis}{#1}%
%
% --------------------
% Allocations:
% --------------------
\listnewempty\axis@plotspeclist
\listnewempty\axis@legend
\listnewempty\axis@stored@plot@cmds
\listnewempty\axis@stored@plot@data
\newif\ifaxis@autocompute@xlim
\newif\ifaxis@autocompute@ylim
\newif\ifaxis@filtercoords
\newif\ifaxis@float@numerics@mode@x
\newif\ifaxis@float@numerics@mode@y
\newif\ifaxis@float@numerics@mode
% rename '\ifaxis@hide axis' to mask the white space:
\expandafter\let\expandafter\ifaxis@hide\csname ifaxis@hide axis\endcsname
% the same for other options with white spaces:
\expandafter\let\expandafter\ifaxis@scale@only@axis\csname ifaxis@scale only axis\endcsname
\newif\ifaxis@draw@at@end
\newif\ifaxis@limits@are@computed
\newif\ifaxis@EMERGENCY@FORCE@DATA@TRAFO@TO@IDENTITY
\axis@numplots=0
\let\axis@already@computed@legend@node=\empty
%
% --------------------
% Option preprocessing
% --------------------
\axis@prepare@coord@filtering@for x
\axis@prepare@coord@filtering@for y
%
\ifx\axis@xfilter\empty
\else
\axis@filtercoordstrue
\fi
\ifx\axis@yfilter\empty
\else
\axis@filtercoordstrue
\fi
%
\ifx\axis@xmin\empty
\axis@autocompute@xlimtrue
\def\axis@xmin{16300}%
\ifaxis@float@numerics@mode@x
\scisetcomponents\axis@xmin{1}{1.0}{324}%
\fi
\fi
\ifx\axis@xmax\empty
\axis@autocompute@xlimtrue
\def\axis@xmax{-16300}%
\ifaxis@float@numerics@mode@x
\scisetcomponents\axis@xmax{2}{1.0}{324}%
\fi
\fi
\ifx\axis@ymin\empty
\axis@autocompute@ylimtrue
\def\axis@ymin{16300}%
\ifaxis@float@numerics@mode@y
\scisetcomponents\axis@ymin{1}{1.0}{324}%
\fi
\fi
\ifx\axis@ymax\empty
\axis@autocompute@ylimtrue
\def\axis@ymax{-16300}%
\ifaxis@float@numerics@mode@y
\scisetcomponents\axis@ymax{2}{1.0}{324}%
\fi
\fi
%
\ifaxis@autocompute@xlim
\axis@draw@at@endtrue
\axis@limits@are@computedfalse
\else
\axis@limits@are@computedtrue
\fi
\ifaxis@autocompute@ylim
\axis@draw@at@endtrue
\axis@limits@are@computedfalse
\else
\axis@limits@are@computedtrue
\fi
%
%
% --------------------
% Start axis:
% either postponed to \end or directly.
% --------------------
%
\ifaxis@draw@at@end
\else
\axis@BEGIN@init@and@draw@axis
\fi
}{%
%\end{axis}:
% --------------------
% All plotting commands
% have been done.
% -> apply postponed drawing commands!
% --------------------
\ifaxis@draw@at@end
\ifaxis@limits@are@computed
\else
% EMPTY AXIS:
\def\axis@xmin{0}%
\def\axis@xmax{1}%
\def\axis@ymin{0}%
\def\axis@ymax{1}%
\fi
\axis@BEGIN@init@and@draw@axis
\listforeach\axis@stored@plot@cmds\as\plotcmd{%
\listpopfront\axis@stored@plot@data\to\plotdata
\ifaxis@float@numerics@mode
\ifx\plotcmd\empty
\plotdata
\else
% Apply the data scaling transformation
\expandafter\axis@apply@data@scaletrafo@to@plot@data\plotdata\to\plotdata
\expandafter\plotcmd\plotdata
\fi
\else
\expandafter\plotcmd\plotdata
\fi
}%
\fi
\axis@END@init@and@draw@axis
%
\begin{scope}[%
xshift=+\axis@xcoordminTEX,
yshift=\axis@ycoordminTEX,
x={\axis@xcoordmaxTEX-\axis@xcoordminTEX},
y={\axis@ycoordmaxTEX-\axis@ycoordminTEX}
]%
\axis@create@axis@descriptions
\end{scope}%
\end{scope}% this scope starts inside of \axis@BEGIN@init@and@draw@axis
%
\end{scope}%
\endgroup
}
\newenvironment{semilogxaxis}[1][]{%
\begin{axis}[xmode=log,ymode=normal,#1]
}{%
\end{axis}%
}
\newenvironment{semilogyaxis}[1][]{%
\begin{axis}[xmode=normal,ymode=log,#1]
}{%
\end{axis}%
}
\newenvironment{loglogaxis}[1][]{%
\begin{axis}[xmode=log,ymode=log,#1]
}{%
\end{axis}%
}
|