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
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
|
\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{}
% $Id: pst-plot-doc.tex 1056 2019-05-17 07:39:59Z herbert $
\documentclass[11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,headings=small,
headinclude=false,footinclude=false,twoside]{pst-doc}
\listfiles
%\usepackage[utf8]{inputenc}
\usepackage{pst-ode,
pst-node,
pst-calculate,
pst-plot
}
\let\pstFV\fileversion
\let\belowcaptionskip\abovecaptionskip
%
\def\bgImage{%
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psaxes[axesstyle=polar,subticklinestyle=dashed,subticks=2,
labelFontSize=\scriptstyle](3,360)
\psplot[polarplot,algebraic,linecolor=red,linewidth=2pt,
plotpoints=2000]{0}{TwoPi}{6*sin(x)*cos(x)}
\end{pspicture}
}
\lstset{explpreset={pos=l,width=-99pt,overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,rframe={}},
escapechar=?}
\def\textat{\char064}%
%\usepackage{biblatex}
\addbibresource{pst-plot-doc.bib}
\begin{document}
\title{\texttt{pst-plot}\\plotting data and functions \\\small v.\pstFV}
\docauthor{Herbert Vo\ss}
\author{Timothy Van Zandt\\Herbert Vo\ss}
\date{\today}
\settitle
\begin{abstract}
This version of \LPack{pst-plot} uses the extended keyval handling
of \LPack{pst-xkey} and has a lot of the macros which were recently in
the package \LPack{pstricks-add}. This documentation describes only the
new and changed stuff. For the default behaviour look into the
documentation part of the base \LPack{pstricks} package. You find the
documentation here: \url{https://mirror.ctan.org/graphics/pstricks/base/doc/}.
\vfill
\noindent
Thanks to:
Guillaume van Baalen;
Stefano Baroni;
Martin Chicoine;
Gerry Coombes;
Ulrich Dirr;
Christophe Fourey;
Hubert Gäßlein;
Jürgen Gilg;
Denis Girou;
Peter Hutnick;
Christophe Jorssen;
Uwe Kern;
Alexander Kornrumpf;
Marcel Krüger;
Manuel Luque;
Patrice Mégret;
Jens-Uwe Morawski;
Tobias Nähring;
Rolf Niepraschk;
Martin Paech;
Alan Ristow;
Christine Römer;
Arnaud Schmittbuhl;
Uwe Siart;
Thomas Söll;
\end{abstract}
\clearpage
\tableofcontents
\clearpage
\part{Basic commands, connections and labels}
\section{Introduction}
The plotting commands described in this part are defined in the very first version
of \LPack{pst-plot.tex} and available for all new and ancient versions.
The \Lcs{psdots}, \Lcs{psline}, \Lcs{pspolygon}, \Lcs{pscurve}, \Lcs{psecurve} and
\Lcs{psccurve} graphics objects let you plot data in a variety of ways. However,
first you have to generate the data and enter it as coordinate pairs \CAny.
The plotting macros in this section give you other ways to get and use the
data. %(Section \ref{S-axes} tells you how to generate axes.)
To parameter
\Lkeyset{plotstyle=style}
determines what kind of plot you get. Valid styles are \Lkeyval{dots}, \Lkeyval{line},
\Lkeyval{polygon}, \Lkeyval{curve}, \Lkeyval{ecurve}, \Lkeyval{ccurve}. E\,,g., if the \Lkeyword{plotstyle} is
\Lkeyval{polygon}, then the macro becomes a variant of the \Lcs{pspolygon} object.
You can use arrows with the plot styles that are open curves, but there is no
optional argument for specifying the arrows. You have to use the \Lkeyword{arrows}
parameter instead.
No\XInfoDanger{~} PostScript error checking is provided for the data arguments. %Read Appendix
%\ref{S-raw} before including PostScript code in the arguments.
There are system-dependent limits on the amount of data \TeX{} and PostScript
can handle. You are much less likely to exceed the PostScript limits when you
use the \Lkeyval{line}, \Lkeyval{polygon} or \Lkeyval{dots} plot style, with \LKeyword{showpoints=false},
\LKeyset{linearc=0pt}, and no arrows.
Note that the lists of data generated or used by the plot commands cannot
contain units. The values of \Lcs{psxunit} and \Lcs{psyunit} are used as the unit.
\section{Plotting data records}
\begin{BDef}
\Lcs{fileplot}\OptArgs\Largb{file}\\
\Lcs{psfileplot}\OptArgs\Largb{file}\\
\Lcs{dataplot}\OptArgs\Largb{\Lcs{\Larga{macro}}}\\
\Lcs{psdataplot}\OptArgs\Largb{\Lcs{\Larga{macro}}}\\
\Lcs{savedata}\Largb{\Lcs{\Larga{macro}}}\Largs{data}\\
\Lcs{readdata}\Largb{\Lcs{\Larga{macro}}}\Largb{file}\\
\Lcs{psreadDataColumn}\OptArgs\Largb{colNo}\Largb{delimiter}\Largb{\Lcs{\Larga{macro}}}\Largb{filename}\\
\Lcs{listplot}\Largb{data}\\
\Lcs{pslistplot}\Largb{data}
\end{BDef}
The macros with a preceeding \verb|ps| are equivalent to those without.
\Lcs{fileplot} is the simplest of the plotting functions to use. You just need a
file that contains a list of coordinates (without units), such as generated by
Mathematica or other mathematical packages. The data can be delimited by curly
braces \verb|{ }|, parentheses \verb|( )|, commas, and/or white space. Bracketing
all the data with square brackets \verb|[ ]| will significantly speed up the rate
at which the data is read, but there are system-dependent limits on how much
data \TeX{} can read like this in one chunk. (The \verb|[| \emph{must} go at the
beginning of a line.) The file should not contain anything else (not even
\Lcs{endinput}), except for comments marked with \verb|%|.
\Lcs{fileplot} only recognizes the \Lkeyval{line}, \Lkeyval{polygon} and \Lkeyval{dots} plot styles, and
it ignores the \Lkeyword{arrows}, \Lkeyword{linearc} and \Lkeyword{showpoints} parameters. The
\Lcs{listplot} command, described below, can also plot data from file, without
these restrictions and with faster \TeX{} processing. However, you are less
likely to exceed PostScript's memory or operand stack limits with \Lcs{fileplot}.
If you find that it takes \TeX{} a long time to process your \Lcs{fileplot}
command, you may want to use the \Lcs{PSTtoEPS} command described on page
\pageref{+PSTtoEPS}. This will also reduce \TeX's memory requirements.
\Lcs{dataplot} is also for plotting lists of data generated by other programs,
but you first have to retrieve the data with one of the following commands:
\Larg{data} or the data in \Larg{file} should conform to the rules described above for
the data in \Lcs{fileplot} (with \Lcs{savedata}, the data must be delimited by
\verb|[ ]|, and with \Lcs{readdata}, bracketing the data with \verb|[ ]| speeds things
up). You can concatenate and reuse lists, as in
\begin{lstlisting}[style=syntax]
\readdata{\foo}{data/foo.data}
\readdata{\bar}{data/bar.data}
\dataplot{\foo\bar}
\dataplot[origin={0,1}]{\bar}
\end{lstlisting}
The \Lcs{readdata} and \Lcs{dataplot} combination is faster than \Lcs{fileplot}
if you reuse the data. \Lcs{fileplot} uses less of \TeX's memory than
\Lcs{readdata} and \Lcs{dataplot} if you are also use \Lcs{PSTtoEPS}.
Here is a plot of $\int\sin(x)\mathrm{d}x$. The data was generated by Mathematica,
with
\begin{lstlisting}
Table[{x,N[SinIntegral[x]]},{x,0,20}]
\end{lstlisting}
and then copied to this document.
\begin{LTXexample}[pos=t]
\pspicture(4,3) \psset{xunit=.2cm,yunit=1.5cm}
\savedata{\mydata}[
{{0, 0}, {1., 0.946083}, {2., 1.60541}, {3., 1.84865}, {4., 1.7582},
{5., 1.54993}, {6., 1.42469}, {7., 1.4546}, {8., 1.57419},
{9., 1.66504}, {10., 1.65835}, {11., 1.57831}, {12., 1.50497},
{13., 1.49936}, {14., 1.55621}, {15., 1.61819}, {16., 1.6313},
{17., 1.59014}, {18., 1.53661}, {19., 1.51863}, {20., 1.54824}}]
\dataplot[plotstyle=curve,showpoints,dotstyle=triangle]{\mydata}
\psline{<->}(0,2)(0,0)(22,0)
\endpspicture
\end{LTXexample}
\Lcs{listplot} is yet another way of plotting lists of data. This time, <list>
should be a list of data (coordinate pairs), delimited only by white space.
\Larg{list} is first expanded by \TeX{} and then by PostScript. This means that
\Larg{list} might be a PostScript program that leaves on the stack a list of data,
but you can also include data that has been retrieved with \Lcs{readdata} and
\Lcs{dataplot}. However, when using the \Lkeyval{line}, \Lkeyval{polygon} or \Lkeyval{dots} plotstyles
with \LKeyset{showpoints=false}, \LKeyset{linearc=0pt} and no arrows, \Lcs{dataplot} is much
less likely than \Lcs{listplot} to exceed PostScript's memory or stack limits.
In the preceding example, these restrictions were not satisfied, and so the
example is equivalent to when \Lcs{listplot} is used:
\begin{lstlisting}[style=syntax]
...
\listplot[plotstyle=curve,showpoints=true,dotstyle=triangle]{\mydata}
...
\end{lstlisting}
\section{Plotting mathematical functions}
\begin{BDef}
\Lcs{psplot}\OptArgs\Largb{$x_!\min@$}\Largb{$x_!\max@$}\Largb{function}\\
\Lcs{parametricplot}\OptArgs\Largb{$t_!\min@$}\Largb{$t_!\max@$}\Largb{x(t) y(t)}\\
\Lcs{parametricplot}\OptArg{algebraic,...}\Largb{$t_!\min@$}\Largb{$t_!\max@$}\Largb{x(t) | y(t)}
\end{BDef}
\Lcs{psplot} can be used to plot a function $f(x)$, if you know a little
PostScript. \Larg{function} should be the PostScript or algebraic code for calculating $f(x)$.
Note that you must use $x$ as the dependent variable.
\begin{lstlisting}
\psplot[plotpoints=200]{0}{720}{x sin}
\end{lstlisting}
plots $\sin(x)$ from 0 to 720 degrees, by calculating $\sin(x)$ roughly every
3.6 degrees and then connecting the points with \Lcs{psline}. Here are plots of
$\sin(x)\cos((x/2)^2)$ and $\sin^2(x)$:
\begin{LTXexample}[pos=t]
\pspicture(0,-1)(4,1)
\psset{xunit=1.2pt}
\psplot[linecolor=gray,linewidth=1.5pt,plotstyle=curve]{0}{90}{x sin dup mul}
\psplot[plotpoints=100]{0}{90}{x sin x 2 div 2 exp cos mul}
\psline{<->}(0,-1)(0,1) \psline{->}(100,0)
\endpspicture
\end{LTXexample}
\Lcs{parametricplot} is for a parametric plot of $(x(t),y(t))$. \Larg{function} is the PostScript
code or algebraic expression for calculating the pair $x(t)$ $y(t)$. For an algebraic expression they must be
devided by a vertical rule.
For example,
\begin{LTXexample}[wide,width=4cm]
\pspicture(3,3)
\parametricplot[plotstyle=dots,plotpoints=13]%
{-6}{6}{1.2 t exp 1.2 t neg exp}
\endpspicture
\end{LTXexample}
plots 13 points from the hyperbola $xy=1$, starting with $(1.2^{-6},1.2^6)$
and ending with $(1.2^6,1.2^{-6})$.
Here is a parametric plot of $(\sin(t),\sin(2t))$:
\begin{LTXexample}[wide,width=4cm]
\pspicture(-2,-1)(2,1)
\psset{xunit=1.7cm}
\parametricplot[linewidth=1.2pt,plotstyle=ccurve]%
{0}{360}{t sin t 2 mul sin}
\psline{<->}(0,-1.2)(0,1.2)
\psline{<->}(-1.2,0)(1.2,0)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[wide,width=6.5cm]
\begin{pspicture}[showgrid,algebraic](-3,-3)(3,3)
\psframe[dimen=m](-3,-3)(3,3)
\pscustom[fillstyle=hlines]{%
\psplot{-3}{3}{-x^2/3}
\psparametricplot{-3}{3}{t^2/3 | t}
\psplot{3}{-3}{x^2/3}
\psparametricplot{3}{-3}{-t^2/3 | t}
}
\end{pspicture}
\end{LTXexample}
The number of points that the \Lcs{psplot} and \Lcs{parametricplot} commands
calculate is set by the
\LKeyset{plotpoints=<value>}
parameter. Using "curve" or its variants instead of "line" and increasing the
value of \Lkeyword{plotpoints} are two ways to get a smoother curve. Both ways
increase the imaging time. Which is better depends on the complexity of the
computation. (Note that all PostScript lines are ultimately rendered as a
series (perhaps short) line segments.) Mathematica generally uses "lineto" to
connect the points in its plots. The default minimum number of plot points for
Mathematica is 25, but unlike \Lcs{psplot} and \Lcs{parametricplot}, Mathematica
increases the sampling frequency on sections of the curve with greater
fluctuation.
\part{New commands}
%--------------------------------------------------------------------------------------
\section[Extended syntax]{Extended syntax for \nxLcs{psplot}, \nxLcs{psparametricplot}, and \nxLcs{psaxes}}
There is now a new optional argument for \Lcs{psplot} and \Lcs{psparametricplot} to pass
additional \PS commands into the code. This makes the use of \Lcs{pstVerb} in
most cases superfluous.
\begin{BDef}
\Lcs{psplot}\OptArgs\Largb{x0}\Largb{x1}\OptArg{PS commands}\Largb{function}\\
\Lcs{psparametricplot}\OptArgs\Largb{t0}\Largb{t1}\OptArg{PS commands}\Largb{x(t) y(t)}\\
\Lcs{psparametricplot}\OptArg{algebraic,...}\Largb{t0}\Largb{t1}\OptArg{PS commands}\Largb{x(t) | y(t)}\\
\Lcs{psaxes}\OptArgs\OptArg*{\Largb{arrows}}\coord0\coord1\coord2\OptArg{Xlabel,Xangle}\OptArg{Ylabel,Yangle}
\end{BDef}
The macro \Lcs{psaxes} has now four optional arguments, one for the setting, one for
the arrows, one for the x-label and one for the y-label. If you
want only a y-label, then leave the x one empty. A missing y-label
is possible. The following examples show how it can be used.
\begin{lstlisting}
\begin{pspicture}(-1,-0.5)(12,5)
\psaxes[Dx=100,dx=1,Dy=0.00075,dy=1]{->}(0,0)(12,5)?\ON?[$x$,-90][$y$,180]?\OFF?
\psplot[linecolor=red, plotstyle=curve,linewidth=2pt,plotpoints=200]{0}{11}%
?\ON?[ /const1 3.3 10 8 neg exp mul def ?\OFF?
?\ON?/s 10 def ?\OFF?
?\ON?/const2 6.04 10 6 neg exp mul def ] % optional PS commands?\OFF?
{ const1 x 100 mul dup mul mul Euler const2 neg x 100 mul dup mul mul exp mul 2000 mul}
\end{pspicture}
\end{lstlisting}
\begin{pspicture}(-1,-0.5)(12,5)
\psaxes[Dx=100,dx=1,Dy=0.00075,dy=1]{->}(0,0)(12,5)[$x$,-90][$y$,180]
\psplot[linecolor=red, plotstyle=curve,linewidth=2pt,plotpoints=200]{0}{11}%
[ /const1 3.3 10 8 neg exp mul def
/s 10 def
/const2 6.04 10 6 neg exp mul def ] % optional PS commands
{ const1 x 100 mul dup mul mul Euler const2 neg x 100 mul dup mul mul exp mul 2000 mul}
\end{pspicture}
%--------------------------------------------------------------------------------------
\clearpage
\section{New Macro \nxLcs{psBoxplot}}
%--------------------------------------------------------------------------------------
A \Index{box-and-whisker plot} (often called simply a \Index{box plot}) is a histogram-like method of
displaying data, invented by John.\,Tukey. The box-and-whisker plot is a box with
ends at the quartiles $Q_1$ and $Q_3$ and has a statistical median M as a horizontal line in
the box. The "`whiskers"* are lines to the farthest points that are not outliers (i.e.,
that are within 3/2 times the interquartile range of $Q_1$ and $Q_3$). Then, for every point
more than 3/2 times the interquartile range from the end of a box, is a dot.
The only special optional arguments, beside all other which are valid for drawing lines
and filling areas, are \Lkeyword{IQLfactor}, \Lkeyword{barwidth}, and
\Lkeyword{arrowlength}, where the latter is a factor
which is multiplied with the barwidth for the line ends.
The \Lkeyword{IQLfactor}, preset to 1.5, defines the area for the outliners.
The outliners are plotted as a dot and take the settings for such a dot into account,
eg. \Lkeyword{dotstyle}, \Lkeyword{dotsize}, \Lkeyword{dotscale}, and \Lkeyword{fillcolor}. The default
is the black dot.
%\begin{LTXexample}[pos=t,preset=\centering]
\begin{pspicture}(-1,-1)(12,14)
\psset{yunit=0.1,fillstyle=solid}
\savedata{\data}[100 90 120 115 120 110 100 110 100 90 100 100 120 120 120]
\rput(1,0){\psBoxplot[fillcolor=red!30]{\data}}
\rput(1,105){2001}
\savedata{\data}[90 120 115 116 115 110 90 130 120 120 120 85 100 130 130]
\rput(3,0){\psBoxplot[arrowlength=0.5,fillcolor=blue!30]{\data}}
\rput(3,107){2008}
\savedata{\data}[35 70 90 60 100 60 60 80 80 60 50 55 90 70 70]
\rput(5,0){\psBoxplot[barwidth=40pt,arrowlength=1.2,fillcolor=red!30]{\data}}
\rput(5,65){2001}
\savedata{\data}[60 65 60 75 75 60 50 90 95 60 65 45 45 60 90]
\rput(7,0){\psBoxplot[barwidth=40pt,fillcolor=blue!30]{\data}}
\rput(7,65){2008}
\savedata{\data}[20 20 25 20 15 20 20 25 30 20 20 20 30 30 30]
\rput(9,0){\psBoxplot[fillcolor=red!30]{\data}}
\rput(9,22){2001}
\savedata{\data}[20 30 20 35 35 20 20 60 50 20 35 15 30 20 40]
\rput(11,0){\psBoxplot[fillcolor=blue!30,linestyle=dashed]{\data}}
\rput(11,25){2008}
\psaxes[dy=1cm,Dy=10](0,0)(12,130)
\end{pspicture}
%\end{LTXexample}
\begin{lstlisting}
\begin{pspicture}(-1,-1)(12,14)
\psset{yunit=0.1,fillstyle=solid}
\savedata{\data}[100 90 120 115 120 110 100 110 100 90 100 100 120 120 120]
\rput(1,0){?\ON?\psBoxplot?\OFF?[fillcolor=red!30]{\data}}
\rput(1,105){2001}
\savedata{\data}[90 120 115 116 115 110 90 130 120 120 120 85 100 130 130]
\rput(3,0){?\ON?\psBoxplot?\OFF?[arrowlength=0.5,fillcolor=blue!30]{\data}}
\rput(3,107){2008}
\savedata{\data}[35 70 90 60 100 60 60 80 80 60 50 55 90 70 70]
\rput(5,0){?\ON?\psBoxplot?\OFF?[barwidth=40pt,arrowlength=1.2,fillcolor=red!30]{\data}}
\rput(5,65){2001}
\savedata{\data}[60 65 60 75 75 60 50 90 95 60 65 45 45 60 90]
\rput(7,0){?\ON?\psBoxplot?\OFF?[barwidth=40pt,fillcolor=blue!30]{\data}}
\rput(7,65){2008}
\savedata{\data}[20 20 25 20 15 20 20 25 30 20 20 20 30 30 30]
\rput(9,0){?\ON?\psBoxplot?\OFF?[fillcolor=red!30]{\data}}
\rput(9,22){2001}
\savedata{\data}[20 30 20 35 35 20 20 60 50 20 35 15 30 20 40]
\rput(11,0){?\ON?\psBoxplot?\OFF?[fillcolor=blue!30,linestyle=dashed]{\data}}
\rput(11,25){2008}
\psaxes[dy=1cm,Dy=10](0,0)(12,130)
\end{pspicture}
\end{lstlisting}
The next example uses an external file for the data, which must first be read by the
macro \Lcs{readdata}. The next one creates a horizontal boxplot by rotating
the output with $-90$ degrees.
%\begin{LTXexample}[pos=t]
\readdata{\data}{data/boxplot.data}
\begin{pspicture}(-1,-1)(2,10)
\psset{yunit=0.25,fillstyle=solid}
\savedata{\data}[2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32]
\rput(1,0){\psBoxplot[fillcolor=blue!30]{\data}}
\psaxes[dy=1cm,Dy=4](0,0)(2,35)
\end{pspicture}
%
\begin{pspicture}(-1,-1)(11,2)
\psset{xunit=0.25,fillstyle=solid}
\savedata{\data}[2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32]
\rput{-90}(0,1){\psBoxplot[yunit=0.25,fillcolor=blue!30]{\data}}
\psaxes[dx=1cm,Dx=4](0,0)(35,2)
\end{pspicture}
%\end{LTXexample}
\begin{lstlisting}
\readdata{\data}{data/boxplot.data}
\begin{pspicture}(-1,-1)(2,10)
\psset{yunit=0.25,fillstyle=solid}
\savedata{\data}[2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32]
\rput(1,0){?\ON?\psBoxplot?\OFF?[fillcolor=blue!30]{\data}}
\psaxes[dy=1cm,Dy=4](0,0)(2,35)
\end{pspicture}
%
\begin{pspicture}(-1,-1)(11,2)
\psset{xunit=0.25,fillstyle=solid}
\savedata{\data}[2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32]
\rput{-90}(0,1){\psBoxplot[yunit=0.25,fillcolor=blue!30]{\data}}
\psaxes[dx=1cm,Dx=4](0,0)(35,2)
\end{pspicture}
\end{lstlisting}
It is also possible to read a data column from an external file:
\begin{pspicture}(-1,-1)(5,6)
\psaxes[axesstyle=frame,dy=1cm,Dy=20,ticksize=4pt 0](0,0)(4,5)
\psreadDataColumn{1}{,}{\data}{data/Data.dat}
\rput(1,0){\psBoxplot[fillcolor=red!40,yunit=0.05]{\data}}
\psreadDataColumn{2}{,}{\data}{data/Data.dat}
\rput(3,0){\psBoxplot[fillcolor=blue!40,yunit=0.05]{\data}}
\end{pspicture}
\begin{lstlisting}
\begin{filecontents*}{data/Data.dat}
98, 32
20, 11
79, 26
14, 9
23, 22
21, 10
58, 25
13, 8
19, 5
53, 29
41, 37
11, 2
83, 25
71, 51
10, 7
89, 17
10, 6
, 41
, 75
\end{filecontents*}
\begin{pspicture}(-1,-1)(5,6)
\psaxes[axesstyle=frame,dy=1cm,Dy=20,ticksize=4pt 0](0,0)(4,5)
\psreadDataColumn{1}{,}{\data}{data/Data.dat}
\rput(1,0){\psBoxplot[fillcolor=red!40,yunit=0.05]{\data}}
\psreadDataColumn{2}{,}{\data}{data/Data.dat}
\rput(3,0){\psBoxplot[fillcolor=blue!40,yunit=0.05]{\data}}
\end{pspicture}
\end{lstlisting}
With the optional argument \Lkeyword{postAction} one can modify the $y$ value of the boxplot, e.g. for
an output with a vertical axis in logarithm scaling:
\begin{pspicture}(-1,-3)(6,5)
\psset{fillstyle=solid}
\iffalse
\psaxes[ylogBase=10,Oy=-2,logLines=y,ticksize=0 4pt, subticks=5](1,-2)(9,4)
\rput(3,0){\psBoxplot[fillcolor=red!30,barwidth=0.9cm,postAction=1 gt {Log} if]{
0.09 0.44 0.12 0.06 0.32 0.23 0.44 0.02 0.15 0.18 0 0.29 0 0.11 0.26 0.11
0 0.45 0.04 0.14 0.03 0.12 0.14 0.31 0.06 0.06 0.11 0.12 0.12 0.12 0.13
0.01 0.40 0.01 0.03 0.17 0 0.10 0.15 0.16 0.06 0.10 0.01 0.60 0.26 0.11
0.15 0.22 0.14 0.01 }}
\rput(4,0){\psBoxplot[fillcolor=red!30,barwidth=0.9cm,postAction=1 gt {Log} if]{
0.07 0.49 0.34 0.20 0.02 1.08 6.83 0.31 0.54 0.02 0.29 0.18 0.60 0.09 0.61
1.37 0.26 0.03 2.30 0.09 3.15 0.13 0.29 0.27 1.30 0.73 0.63 0.24 10.03 0
0.26 0.18 3.29 2.43 1.94 0.22 0.23 0.60 1.69 0.35 3.96 0.56 9.90 0.10 0.43
0.22 0.26 0.31 0.29 0.79 }}
\fi
\psaxes[ylogBase=10,Oy=-2,Ox=1,logLines=y,ticksize=0 4pt, subticks=5](1,-2)(6,4)
\rput(2,0){\psBoxplot[fillcolor=red!30,barwidth=0.9cm,postAction=Log]{
12.70 1.34 0.68 0.51 1.77 0.04 3.79 287.05 1.35 5.41 15.56 3.13 0.91 7.48
2.40 1.04 3.53 0.58 31.71 7.89 4.90 2.61 0.89 0.03 3.78 8.11 4.82 1.02 5.57
8.85 0.15 17.59 0.21 8.10 2.15 3.43 6.44 1.65 6.83 23.54 0.52 1.47 0.75
3.54 3.59 5.56 0.33 8.58 1.90 0.78 }}
\rput(3,0){\psBoxplot[fillcolor=red!30,barwidth=0.9cm,postAction=Log]{
55.72 14.91 14.95 6.01 6.53 88.30 281.50 40.15 13.41 0.91 1.65 44.32 13.41
7.33 3.51 3.44 70.40 0.75 58.20 54.88 26.45 33.76 0.70 0.05 0.29 57.12
14.30 31.11 18.56 0.48 21.33 1.15 2.22 3.88 1.78 151.25 7.77 137.92 0.50
3.01 1.99 23.18 119.59 17.50 15.87 13.63 21.85 23.53 68.72 2.90 }}
\rput(4,0){\psBoxplot[fillcolor=red!30,barwidth=0.9cm,postAction=Log]{
1.19 1.94 13.40 7.40 267.30 5.94 11.05 6.51 2.94 5.45 5.24 231 4.48 0.68
311.29 77.47 621.20 139.08 1933.59 2.52 100.96 11.02 153.43 26.67 83.84
4.31 106.34 15.90 1118.59 9.49 131.48 48.92 5.85 3.74 1.05 32.03 5.69
45.10 12.43 238.56 28.75 1.01 119.29 12.09 31.18 16.60 29.67 138.55
17.42 0.83 }}
\rput(5,0){\psBoxplot[fillcolor=red!30,barwidth=0.9cm,postAction=Log]{
2077.45 762.10 469 143.60 685 3600 20.20 249.60 269 0.30 0.20 779.40 1.80
146.80 1.30 32.50 137 2016.40 2.30 33.90 801.60 2.20 646.90 3600 1184 627
500.50 238.30 477.40 3600 17.80 1726.80 2 316.70 174.50 2802.70 335.30
201.20 1.10 247.10 2705.10 156.90 5.10 2342.50 3600 3600 72.70 47.40
301.20 1.60 }}
\end{pspicture}
\begin{lstlisting}
\begin{pspicture}(-1,-3)(6,5)
\psset{fillstyle=solid}
\psaxes[ylogBase=10,Oy=-2,Ox=1,logLines=y,ticksize=0 4pt, subticks=5](1,-2)(6,4)
\rput(2,0){\psBoxplot[fillcolor=red!30,barwidth=0.9cm,postAction=Log]{
12.70 1.34 0.68 0.51 1.77 0.04 3.79 287.05 1.35 5.41 15.56 3.13 0.91 7.48
2.40 1.04 3.53 0.58 31.71 7.89 4.90 2.61 0.89 0.03 3.78 8.11 4.82 1.02 5.57
8.85 0.15 17.59 0.21 8.10 2.15 3.43 6.44 1.65 6.83 23.54 0.52 1.47 0.75
3.54 3.59 5.56 0.33 8.58 1.90 0.78 }}
\rput(3,0){\psBoxplot[fillcolor=red!30,barwidth=0.9cm,postAction=Log]{
55.72 14.91 14.95 6.01 6.53 88.30 281.50 40.15 13.41 0.91 1.65 44.32 13.41
7.33 3.51 3.44 70.40 0.75 58.20 54.88 26.45 33.76 0.70 0.05 0.29 57.12
14.30 31.11 18.56 0.48 21.33 1.15 2.22 3.88 1.78 151.25 7.77 137.92 0.50
3.01 1.99 23.18 119.59 17.50 15.87 13.63 21.85 23.53 68.72 2.90 }}
\rput(4,0){\psBoxplot[fillcolor=red!30,barwidth=0.9cm,postAction=Log]{
1.19 1.94 13.40 7.40 267.30 5.94 11.05 6.51 2.94 5.45 5.24 231 4.48 0.68
311.29 77.47 621.20 139.08 1933.59 2.52 100.96 11.02 153.43 26.67 83.84
4.31 106.34 15.90 1118.59 9.49 131.48 48.92 5.85 3.74 1.05 32.03 5.69
45.10 12.43 238.56 28.75 1.01 119.29 12.09 31.18 16.60 29.67 138.55
17.42 0.83 }}
\rput(5,0){\psBoxplot[fillcolor=red!30,barwidth=0.9cm,postAction=Log]{
2077.45 762.10 469 143.60 685 3600 20.20 249.60 269 0.30 0.20 779.40 1.80
146.80 1.30 32.50 137 2016.40 2.30 33.90 801.60 2.20 646.90 3600 1184 627
500.50 238.30 477.40 3600 17.80 1726.80 2 316.70 174.50 2802.70 335.30
201.20 1.10 247.10 2705.10 156.90 5.10 2342.50 3600 3600 72.70 47.40
301.20 1.60 }}
\end{pspicture}
\end{lstlisting}
It uses the PostScript function \Lps{Log} instead of \Lps{log}. The latter
cannot handle zero values. The next examples shows how a very small intervall
can be handled:
\psset{yunit=0.5cm}
\begin{pspicture}(-2,-1)(2,11)
\savedata{\data}[0.9936 0.9937 0.9934 0.9936 0.9937 0.9938 0.9934 0.9933 0.9930 0.9935]
\psaxes[Oy=0.9930,Dy=0.0005,dy=2cm](0,0)(1,10)
\rput(.5,0){\psBoxplot[barwidth=.5\psxunit,postAction=0.993 sub 1e4 mul]{\data}}
\end{pspicture}
\begin{lstlisting}
\psset{yunit=0.5cm}
\begin{pspicture}(-2,-1)(2,11)
\savedata{\data}[0.9936 0.9937 0.9934 0.9936 0.9937 0.9938 0.9934 0.9933 0.9930 0.9935]
\psaxes[Oy=0.9930,Dy=0.0005,dy=2cm](0,0)(1,10)
\rput(.5,0){\psBoxplot[barwidth=.5\psxunit,postAction=0.993 sub 1e4 mul]{\data}}
\end{pspicture}
\end{lstlisting}
\clearpage
%--------------------------------------------------------------------------------------
\section{The \nxLenv{psgraph} environment}
%--------------------------------------------------------------------------------------
This new environment \Lenv{psgraph} does the scaling, it expects as parameter the values (without units!) for the
coordinate system and the values of the physical width and height (with units!). The syntax is:
\begin{BDef}
\Lcs{psgraph}\OptArgs\Largb{<arrows>}\%\\
\qquad\Largr{xOrig,yOrig}\Largr{xMin,yMin}\Largr{xMax,yMax}\Largb{xLength}\Largb{yLength}\\
\ldots\\
\Lcs{endpsgraph}\\[10pt]
\LBEG{psgraph}\OptArgs\Largb{<arrows>}\%\\
\qquad\Largr{xOrig,yOrig}\Largr{xMin,yMin}\Largr{xMax,yMax}\Largb{xLength}\Largb{yLength}\\
\ldots\\
\LEND{psgraph}
\end{BDef}
where the options are valid \textbf{only} for the the \Lcs{psaxes} macro. The first
two arguments have the usual \verb+PSTricks+ behaviour.
\begin{compactitem}
\item if \verb+(xOrig,yOrig)+ is missing, it is substituted to \verb+(xMin,xMax)+;
\item if \verb+(xOrig,yOrig)+ \textbf{and} \verb+(xMin,yMin)+ are missing, they are both
substituted to \verb+(0,0)+.
\end{compactitem}
The y-length maybe given as !; then the macro uses the same unit
as for the x-axis.
\psset{unit=1cm}
\begin{center}
\readdata{\data}{data/demo1.data}
\pstScalePoints(1,1e-08){}{}% (x,y){additional x operator}{y op}
\psset{llx=-1cm,lly=-1cm}
\begin{psgraph}[axesstyle=frame,xticksize=0 7.59,yticksize=0 25,%
subticks=0,ylabelFactor=\cdot 10^8,
Dx=5,dy=1\psyunit,Dy=1](0,0)(25,7.5){10cm}{6cm} % parameters
\listplot[linecolor=red,linewidth=2pt,showpoints=true]{\data}
\end{psgraph}
\end{center}
\begin{lstlisting}
\readdata{\data}{data/demo1.data}
\pstScalePoints(1,1e-08){}{}% (x,y){additional x operator}{y op}
\psset{llx=-1cm,lly=-1cm}
?\ON?\begin{psgraph}?\OFF?[axesstyle=frame,xticksize=0 7.59,yticksize=0 25,%
subticks=0,ylabelFactor=\cdot 10^8,
Dx=5,dy=1\psyunit,Dy=1](0,0)(25,7.5){10cm}{6cm} % parameters
\listplot[linecolor=red,linewidth=2pt,showpoints=true]{\data}
?\ON?\end{psgraph}?\OFF?
\end{lstlisting}
%-----------------------------------------------------------------------------
In the following example, the y unit gets the same value as the one for the x-axis.
\begin{center}
\psset{llx=-1cm,lly=-0.5cm,ury=0.5cm}
\begin{psgraph}(0,0)(5,3){6cm}{!} % x-y-axis with same unit
\psplot[linecolor=red,linewidth=1pt]{0}{5}{x dup mul 10 div}
\end{psgraph}
\end{center}
\begin{lstlisting}
\psset{llx=-1cm,lly=-0.5cm,ury=0.5cm}
\begin{psgraph}(0,0)(5,3){6cm}?\ON?{!}?\OFF? % x-y-axis with same unit
\psplot[linecolor=red,linewidth=1pt]{0}{5}{x dup mul 10 div}
\end{psgraph}
\end{lstlisting}
%-----------------------------------------------------------------------------
\begin{center}
\readdata{\data}{data/demo1.data}
\psset{xAxisLabel=x-Axis,yAxisLabel=y-Axis,llx=-.5cm,lly=-1cm,lly=-1cm,ury=0.5cm,
xAxisLabelPos={c,-1},yAxisLabelPos={-7,c}}
\pstScalePoints(1,0.00000001){}{}
\begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1,
ylabelFactor=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm}
\listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data}
\end{psgraph}
\end{center}
\begin{lstlisting}
\readdata{\data}{data/demo1.data}
\psset{?\ON?xAxisLabel?\OFF?=x-Axis,?\ON?yAxisLabel?\OFF?=y-Axis,llx=-.5cm,lly=-1cm,ury=0.5cm,
?\ON?xAxisLabelPos?\OFF?={c,-1},?\ON?yAxisLabelPos?\OFF?={-7,c}}
\pstScalePoints(1,0.00000001){}{}
\begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1,
?\ON?ylabelFactor?\OFF?=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm}
\listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data}
\end{psgraph}
\end{lstlisting}
%-----------------------------------------------------------------------------
\begin{LTXexample}[pos=t,preset=\centering]
\readdata{\data}{data/demo1.data}
\psset{llx=-0.5cm,lly=-1cm}
\pstScalePoints(1,0.000001){}{}
\psgraph[arrows=->,Dx=5,dy=200\psyunit,Dy=200,subticks=5,ticksize=-10pt 0,
tickwidth=0.5pt,subtickwidth=0.1pt](0,0)(25,750){5.5cm}{5cm}
\listplot[linecolor=red,linewidth=0.5pt,showpoints=true,dotscale=3,
plotstyle=LineToYAxis,dotstyle=o]{\data}
\endpsgraph
\end{LTXexample}
%-----------------------------------------------------------------------------
\begin{center}
\readdata{\data}{data/demo1.data}
\pstScalePoints(1,0.2){}{log}
\psset{lly=-0.75cm}
\psgraph[ylogBase=10,Dx=5,Dy=1,subticks=5](0,0)(25,2){12cm}{4cm}
\listplot[linecolor=red,linewidth=1pt,showpoints,dotstyle=x,dotscale=2]{\data}
\endpsgraph
\end{center}
\begin{lstlisting}
\readdata{\data}{data/demo1.data}
\pstScalePoints(1,0.2){}{log}
\psset{lly=-0.75cm}
\psgraph[?\ON?ylogBase?\OFF?=10,Dx=5,Dy=1,subticks=5](0,0)(25,2){12cm}{4cm}
\listplot[linecolor=red,linewidth=1pt,showpoints,dotstyle=x,dotscale=2]{\data}
\endpsgraph
\end{lstlisting}
%-----------------------------------------------------------------------------
\begin{LTXexample}[pos=t,preset=\centering]
\readdata{\data}{data/demo0.data}
\psset{lly=-0.75cm,ury=0.5cm}
\pstScalePoints(1,1){}{log}
\begin{psgraph}[arrows=->,Dx=0.5,ylogBase=10,Oy=-1,xsubticks=10,%
ysubticks=2](0,-3)(3,1){12cm}{4cm}
\psset{Oy=-2}% must be global
\listplot[linecolor=red,linewidth=1pt,showpoints=true,
plotstyle=LineToXAxis]{\data}
\listplot[plotstyle=values,rot=90]{\data}
\end{psgraph}
\end{LTXexample}
\begin{LTXexample}[pos=t,preset=\centering]
\psset{lly=-0.75cm,ury=0.5cm}
\readdata{\data}{data/demo0.data}
\pstScalePoints(1,1){}{log}
\psgraph[arrows=->,Dx=0.5,ylogBase=10,Oy=-1,subticks=4](0,-3)(3,1){6cm}{3cm}
\listplot[linecolor=red,linewidth=2pt,showpoints=true,plotstyle=LineToXAxis]{\data}
\endpsgraph
\end{LTXexample}
%-----------------------------------------------------------------------------
\begin{center}
\readdata{\data}{data/demo2.data}%
\readdata{\dataII}{data/demo3.data}%
\pstScalePoints(1,1){1989 sub}{}
\psset{llx=-0.5cm,lly=-1cm, xAxisLabel=Year,yAxisLabel=Whatever,%
xAxisLabelPos={c,-0.4in},yAxisLabelPos={-0.4in,c}}
\psgraph[axesstyle=frame,Dx=2,Ox=1989,subticks=2](0,0)(12,6){4in}{2in}%
\listplot[linecolor=red,linewidth=2pt]{\data}
\listplot[linecolor=blue,linewidth=2pt]{\dataII}
\listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII}
\endpsgraph
\end{center}
\begin{lstlisting}
\readdata{\data}{data/demo2.data}%
\readdata{\dataII}{data/demo3.data}%
\pstScalePoints(1,1){1989 sub}{}
\psset{llx=-0.5cm,lly=-1cm, ?\ON?xAxisLabel?\OFF?=Year,?\ON?yAxisLabel?\OFF?=Whatever,%
?\ON?xAxisLabelPos?\OFF?={c,-0.4in},?\ON?yAxisLabelPos?\OFF?={-0.4in,c}}
\psgraph[axesstyle=frame,Dx=2,Ox=1989,subticks=2](0,0)(12,6){4in}{2in}%
\listplot[linecolor=red,linewidth=2pt]{\data}
\listplot[linecolor=blue,linewidth=2pt]{\dataII}
\listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII}
\endpsgraph
\end{lstlisting}
%-----------------------------------------------------------------------------
%\begin{LTXexample}[pos=t,preset=\centering]
\begin{center}
\readdata{\data}{data/demo2.data}%
\readdata{\dataII}{data/demo3.data}%
\psset{llx=-0.5cm,lly=-0.75cm,plotstyle=LineToXAxis}
\pstScalePoints(1,1){1989 sub}{2 sub}
\begin{psgraph}[axesstyle=frame,Dx=2,Ox=1989,Oy=2,subticks=2](0,0)(12,4){6in}{3in}
\listplot[linecolor=red,linewidth=12pt]{\data}
\listplot[linecolor=blue,linewidth=12pt]{\dataII}
\listplot[linecolor=cyan,linewidth=12pt,yunit=0.5]{\dataII}
\end{psgraph}
\end{center}
%\end{LTXexample}
\begin{lstlisting}
\readdata{\data}{data/demo2.data}%
\readdata{\dataII}{data/demo3.data}%
\psset{llx=-0.5cm,lly=-0.75cm,plotstyle=LineToXAxis}
\pstScalePoints(1,1){1989 sub}{2 sub}
\begin{psgraph}[axesstyle=frame,Dx=2,Ox=1989,Oy=2,subticks=2](0,0)(12,4){6in}{3in}
\listplot[linecolor=red,linewidth=12pt]{\data}
\listplot[linecolor=blue,linewidth=12pt]{\dataII}
\listplot[linecolor=cyan,linewidth=12pt,yunit=0.5]{\dataII}
\end{psgraph}
\end{lstlisting}
%\newpage
An example with ticks on every side of the frame and filled areas:
\begin{center}
\def\data{0 0 1 4 1.5 1.75 2.25 4 2.75 7 3 9}
\psset{lly=-0.5cm}
\begin{psgraph}[axesstyle=none,ticks=none,labels=none](0,0)(3.0,9.0){12cm}{5cm}
\pscustom[fillstyle=solid,fillcolor=red!40,linestyle=none]{%
\listplot{\data}
\psline(3,9)(3,0)}
\pscustom[fillstyle=solid,fillcolor=blue!40,linestyle=none]{%
\listplot{\data}
\psline(3,9)(0,9)}
\listplot[linewidth=2pt]{\data}
\psaxes[axesstyle=frame,ticksize=0 5pt,xsubticks=20,ysubticks=4,ticks=all,labels=all,
tickstyle=inner,dy=2,Dy=2,tickwidth=1.5pt,subtickcolor=black](0,0)(3,9)
\rput*(2.5,3){level 1}\rput*(1,7){level 2}
\end{psgraph}
\end{center}
\begin{lstlisting}
\def\data{0 0 1 4 1.5 1.75 2.25 4 2.75 7 3 9}
\psset{lly=-0.5cm}
\begin{psgraph}[axesstyle=none,ticks=none,labels=none](0,0)(3.0,9.0){12cm}{5cm}
\pscustom[fillstyle=solid,fillcolor=red!40,linestyle=none]{%
\listplot{\data}
\psline(3,9)(3,0)}
\pscustom[fillstyle=solid,fillcolor=blue!40,linestyle=none]{%
\listplot{\data}
\psline(3,9)(0,9)}
\listplot[linewidth=2pt]{\data}
\psaxes[axesstyle=frame,ticksize=0 5pt,xsubticks=20,ysubticks=4,ticks=all,labels=all,
tickstyle=inner,dy=2,Dy=2,tickwidth=1.5pt,subtickcolor=black](0,0)(3,9)
\rput*(2.5,3){level 1}\rput*(1,7){level 2}
\end{psgraph}
\end{lstlisting}
\clearpage
\subsection{Coordinates of the \nxLenv{psgraph} area}
The coordinates of the calculated area are saved in the four macros \Lcs{psgraphLLx}, \Lcs{psgraphLLy}, \Lcs{psgraphURx}, and \Lcs{psgraphURy},
which is LowerLeft, UpperLeft, LowerRight, and UpperRight. The values have no dimension but are saved in the current unit.
\begin{LTXexample}[width=4cm]
\psset{llx=-5mm,lly=-1cm}
\begin{psgraph}[axesstyle=none,ticks=none](0,0)(3.0,9.0){4cm}{5cm}
\psdot[dotscale=2](\psgraphLLx,\psgraphLLy)
\psdot[dotscale=2](\psgraphLLx,\psgraphURy)
\psdot[dotscale=2](\psgraphURx,\psgraphLLy)
\psdot[dotscale=2](\psgraphURx,\psgraphURy)
\end{psgraph}
\end{LTXexample}
%-------------------------------------------------------------------------------------------
\subsection{The new options for \nxLenv{psgraph}}\label{psgraphoptions}
%-------------------------------------------------------------------------------------------
\begin{center}
\begin{tabular}{@{} l>{\ttfamily}ll @{}}
\textrm{name} & \textrm{default} & meaning\\\hline
\Lkeyword{xAxisLabel} & x & label for the x-axis\\
\Lkeyword{yAxisLabel} & y & label for the y-axis\\
\Lkeyword{xAxisLabelPos} & \{\} & where to put the x-label\\
\Lkeyword{yAxisLabelPos} & \{\} & where to put the y-label\\
\Lkeyword{xlabelsep} & 5pt & labelsep for the x-axis labels\\
\Lkeyword{ylabelsep} & 5pt & labelsep for the x-axis labels\\
\Lkeyword{llx} & 0pt & trim for the lower left x\\
\Lkeyword{lly} & 0pt & trim for the lower left y\\
\Lkeyword{urx} & 0pt & trim for the upper right x\\
\Lkeyword{ury} & 0pt & trim for the upper right y\\
\Lkeyword{axespos} & bottom & draw axes first (bottom or last (top)
\end{tabular}
\end{center}
There is one restriction in using the trim parameters, they must
been set \textbf{before} \Lcs{psgraph} is called. They are
redundant when used as parameters of \Lcs{psgraph} itself. The
\Lkeyword{xAxisLabelPos} and \Lkeyword{yAxisLabelPos} options can use the letter \Lnotation{c} for
centering an $x$-axis or $y$-axis label. The \Lnotation{c} is a replacement for
the $x$ or $y$ value. When using values with units, the position is
always measured from the origin of the coordinate system, which
can be outside of the visible \Lenv{pspicture} environment.
\medskip
\begin{center}
\readdata{\data}{data/demo2.data}%
\readdata{\dataII}{data/demo3.data}%
\psset{llx=-1cm,lly=-1.25cm,urx=0.5cm,ury=0.1in,xAxisLabel=Year,%
yAxisLabel=Whatever,xAxisLabelPos={c,-0.4in},%
yAxisLabelPos={-0.4in,c}}
\pstScalePoints(1,1){1989 sub}{}
\psframebox[linestyle=dashed,boxsep=false]{%
\begin{psgraph}[axesstyle=frame,Ox=1989,subticks=2](0,0)(12,6){0.8\linewidth}{2.5in}%
\listplot[linecolor=red,linewidth=2pt]{\data}%
\listplot[linecolor=blue,linewidth=2pt]{\dataII}%
\listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII}%
\end{psgraph}%
}
\end{center}
\begin{lstlisting}
\readdata{\data}{data/demo2.data}%
\readdata{\dataII}{data/demo3.data}%
\psset{llx=-1cm,lly=-1.25cm,urx=0.5cm,ury=0.1in,xAxisLabel=Year,%
yAxisLabel=Whatever,xAxisLabelPos={c,-0.4in},%
yAxisLabelPos={-0.4in,c}}
\pstScalePoints(1,1){1989 sub}{}
\psframebox[linestyle=dashed,boxsep=false]{%
\begin{psgraph}[axesstyle=frame,Ox=1989,subticks=2](0,0)(12,6){0.8\linewidth}{2.5in}%
\listplot[linecolor=red,linewidth=2pt]{\data}%
\listplot[linecolor=blue,linewidth=2pt]{\dataII}%
\listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII}%
\end{psgraph}%
}
\end{lstlisting}
\subsection{The new macro \Lcs{pslegend} for \nxLenv{psgraph}}\label{pslegend}
\begin{BDef}
\Lcs{pslegend}\OptArg{Reference}\OptArg*{\Largr{xOffset,yOffset}}\Largb{Text}
\end{BDef}
The reference can be one of the \Lkeyval{lb}, \Lkeyval{lt}, \Lkeyval{rb}, or \Lkeyval{rt}, where the
latter is the default. The values for \texttt{xOffset} and \texttt{yOffset} must be multiples of the unit pt.
Without an offset the value of \Lcs{pslabelsep} are used.
The legend has to be defined \emph{before} the environment \Lenv{psgraph}.
\medskip
\begin{center}
\readdata{\data}{data/demo2.data}%
\readdata{\dataII}{data/demo3.data}%
\psset{llx=-1cm,lly=-1.25cm,urx=0.5cm,ury=0.1in,xAxisLabel=Year,%
yAxisLabel=Whatever,xAxisLabelPos={c,-0.4in},%
yAxisLabelPos={-0.4in,c}}
\pstScalePoints(1,1){1989 sub}{}
\pslegend[lt]{\red\rule[1ex]{2em}{1pt} & Data I\\
\blue\rule[1ex]{2em}{1pt} & Data II\\
\cyan\rule[1ex]{2em}{1pt} & Data III}
\begin{psgraph}[axesstyle=frame,Ox=1989,subticks=2](0,0)(12,6){0.8\linewidth}{2.5in}%
\listplot[linecolor=red,linewidth=2pt]{\data}%
\listplot[linecolor=blue,linewidth=2pt]{\dataII}%
\listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII}%
\end{psgraph}%
\end{center}
\begin{lstlisting}
\readdata{\data}{data/demo2.data}%
\readdata{\dataII}{data/demo3.data}%
\psset{llx=-1cm,lly=-1.25cm,urx=0.5cm,ury=0.1in,xAxisLabel=Year,%
yAxisLabel=Whatever,xAxisLabelPos={c,-0.4in},%
yAxisLabelPos={-0.4in,c}}
\pstScalePoints(1,1){1989 sub}{}
\pslegend[lt]{\red\rule[1ex]{2em}{1pt} & Data I\\
\blue\rule[1ex]{2em}{1pt} & Data II\\
\cyan\rule[1ex]{2em}{1pt} & Data III}
\begin{psgraph}[axesstyle=frame,Ox=1989,subticks=2](0,0)(12,6){0.8\linewidth}{2.5in}%
\listplot[linecolor=red,linewidth=2pt]{\data}%
\listplot[linecolor=blue,linewidth=2pt]{\dataII}%
\listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII}%
\end{psgraph}%
\end{lstlisting}
\begin{compactitem}
\item \Lcs{pslegend} uses the commands \Lcs{tabular} and \Lcs{endtabular}, which are only available
when running \LaTeX. With \TeX\ you have to redefine the macro \nxLcs{pslegend@ii}:
\begin{lstlisting}
\def\pslegend@ii[#1](#2){\rput[#1](!#2){\psframebox[style=legendstyle]{%
\footnotesize\tabcolsep=2pt%
\tabular[t]{@{}ll@{}}\pslegend@text\endtabular}}\gdef\pslegend@text{}}
\end{lstlisting}
\item The fontsize can be changed locally for each cell or globally, when also redefining the
macro \nxLcs{pslegend@ii}.
\item If you want to use more than two columns for the table or a shadow box, then redefine \nxLcs{pslegend@ii}.
\end{compactitem}
The macro \Lcs{psframebox} uses the style \Lkeyval{legendstyle} which is preset to \Lkeyset{fillstyle=solid},
\Lkeyset{fillcolor=white}, and \nxLkeyword{linewidth=0.5pt} and can be redefined by
\begin{lstlisting}
\newpsstyle{legendstyle}{fillstyle=solid,fillcolor=red!20,shadow=true}
\end{lstlisting}
\medskip
\begin{center}
\readdata{\data}{data/demo2.data}%
\readdata{\dataII}{data/demo3.data}%
\psset{llx=-1cm,lly=-1.25cm,urx=0.5cm,ury=0.1in,xAxisLabel=Year,%
yAxisLabel=Whatever,xAxisLabelPos={c,-0.4in},%
yAxisLabelPos={-0.4in,c}}
\newpsstyle{legendstyle}{fillstyle=solid,fillcolor=red!20,shadow=true}
\pstScalePoints(1,1){1989 sub}{}
\pslegend[lt](10,10){\red\rule[1ex]{2em}{1pt} & Data I\\
\blue\rule[1ex]{2em}{1pt} & Data II\\
\cyan\rule[1ex]{2em}{1pt} & Data III}
\begin{psgraph}[axesstyle=frame,Ox=1989,subticks=2](0,0)(12,6){0.8\linewidth}{2.5in}%
\listplot[linecolor=red,linewidth=2pt]{\data}%
\listplot[linecolor=blue,linewidth=2pt]{\dataII}%
\listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII}%
\end{psgraph}%
\end{center}
\begin{lstlisting}
\readdata{\data}{data/demo2.data}%
\readdata{\dataII}{data/demo3.data}%
\psset{llx=-1cm,lly=-1.25cm,urx=0.5cm,ury=0.1in,xAxisLabel=Year,%
yAxisLabel=Whatever,xAxisLabelPos={c,-0.4in},%
yAxisLabelPos={-0.4in,c}}
\pstScalePoints(1,1){1989 sub}{}
\newpsstyle{legendstyle}{fillstyle=solid,fillcolor=red!20,shadow=true}
\pslegend[lt](10,10){\red\rule[1ex]{2em}{1pt} & Data I\\
\blue\rule[1ex]{2em}{1pt} & Data II\\
\cyan\rule[1ex]{2em}{1pt} & Data III}
\begin{psgraph}[axesstyle=frame,Ox=1989,subticks=2](0,0)(12,6){0.8\linewidth}{2.5in}%
\listplot[linecolor=red,linewidth=2pt]{\data}%
\listplot[linecolor=blue,linewidth=2pt]{\dataII}%
\listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII}%
\end{psgraph}%
\end{lstlisting}
\clearpage%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{\nxLcs{psxTick} and \nxLcs{psyTick}}
Single ticks with labels on an axis can be set with the two
macros \Lcs{psxTick} and \Lcs{psyTick}. The label is set with the macro \Lcs{pshlabel},
the setting of \Lkeyword{mathLabel} is taken into account.
\begin{BDef}
\Lcs{psxTick}\OptArgs\OptArg*{\Largb{rotation}}\Largr{x value}\Largb{label}\\
\Lcs{psyTick}\OptArgs\OptArg*{\Largb{rotation}}\Largr{y value}\Largb{label}
\end{BDef}
\begin{LTXexample}[width=.4\linewidth]
\begin{psgraph}[Dx=2,Dy=2,showorigin=false]%
(0,0)(-4,-2.2)(4,2.2){.5\textwidth}{!}
\psxTick[linecolor=red,labelsep=-20pt]{45}(1.25){x_0}
\psyTick[linecolor=blue](1){y_0}
\end{psgraph}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\section{\nxLcs{pstScalePoints}}
%--------------------------------------------------------------------------------------
The syntax is
\begin{BDef}
\Lcs{pstScalePoints}\Largr{xScale,xScale}\Largb{xPS}\Largb{yPS}
\end{BDef}
\verb+xScale,yScale+ are decimal values used as scaling factors,
the \verb+xPS+ and \verb+yPS+ are additional PostScript code
applied to the x- and y-values of the data records. This macro is
only valid for the \Lcs{listplot} macro!
\begin{LTXexample}[width=7cm]
\def\data{%
0 0 1 3 2 4 3 1
4 2 5 3 6 6 }
\begin{pspicture}(-0.5,-1)(6,6)
\psaxes{->}(0,0)(6,6)
\listplot[showpoints=true,%
linecolor=red]{\data}
\pstScalePoints(1,0.5){}{3 add}
\listplot[showpoints=true,%
linecolor=blue]{\data}
\end{pspicture}
\end{LTXexample}
\bigskip
\Lcs{pstScalePoints}\Largr{1,0.5}\Largb{}\Largb{3 add} means that \textbf{first} the value $3$ is added
to the $y$ values and \textbf{second} this value is scaled with the factor $0.5$.
As seen for the blue line for $x=0$ we get $y(0)=(0+3)\cdot 0.5=1.5$.
Changes with \Lcs{pstScalePoints} are always global to all following \Lcs{listplot}
macros. This is the reason why it is a good idea to reset the values at the end of the
\Lenv{pspicture} environment.
%--------------------------------------------------------------------------------------
\section{New or extended options}
%--------------------------------------------------------------------------------------
\subsection{Introduction}
The option \Lkeyset{tickstyle=full}|\Lkeyval{top}|\Lkeyval{bottom} no longer works in the
usual way. Only the additional value \Lkeyval{inner} is valid for
\LPack{pst-plot}, because everything can be set by the
\Lkeyword{ticksize} option. When using the \Lkeyword{comma} or
\Lkeyword{trigLabels} option, the macros \Lcs{pshlabel} and
\Lcs{psvlabel} shouldn't be redefined, because the package does
it itself internally in these cases. However, if you need a
redefinition, then do it for \nxLcs{pst@@@hlabel} and
\nxLcs{pst@@@vlabel} with
\begin{lstlisting}[style=syntax]
\makeatletter
\def\pst@@@hlabel#1{...}
\def\pst@@@vlabel#1{...}
\makeatother
\end{lstlisting}
{\rowcolors{1}{blue!10}{red!5}
\begin{longtable}{ llll }
\caption{All new parameters for \texttt{pst-plot}}\\\toprule
\rowcolor{white}\emph{name} & \emph{type} & \emph{default} & \emph{page}\\\midrule
\endfirsthead
\multicolumn{4}{l}{\ldots\ continued}\\\midrule
\rowcolor{white}\emph{name} & \emph{type} & \emph{default} & \emph{page}\\\midrule
\endhead
\midrule
\multicolumn{4}{r}{continued \ldots}\\
\endfoot
\bottomrule
\endlastfoot
\Lkeyword{axesstyle} & \Lkeyval{none}|\Lkeyval{axes}|\Lkeyval{frame}|\Lkeyval{polar}|\Lkeyval{inner}
& \Lkeyval{axes} &\pageref{axesstyle}\\
\Lkeyword{barwidth} & length & 0.25cm & \pageref{barwidth}\\ %ok
\Lkeyword{ChangeOrder} & boolean & \false & \pageref{changeorder}\\
\Lkeyword{comma} & boolean & \false & \pageref{comma}\\ %ok
\Lkeyword{decimals} & integer & -1\footnote{A negative value plots all decimals}
& \pageref{values}\\
\Lkeyword{decimalSeparator} & char & . & \pageref{comma}\\ %ok
\Lkeyword{fontscale} & real & 10 & \pageref{values}\\
\Lkeyword{fractionLabelBase} & integer & 0 & \pageref{fraclabels}\\
\Lkeyword{fractionLabels} & boolean & \false & \pageref{fraclabels}\\
\Lkeyword{ignoreLines} & integer & 0 & \pageref{ignorelines}\\
\Lkeyword{labelFontSize} & macro & \{\} & \pageref{labelfontsize}\\
\Lkeyword{labels} & \Lkeyval{all}|\Lkeyval{x}|\Lkeyval{y}|\Lkeyval{none}
& \Lkeyval{all} & \pageref{labels}\\%ok
\Lkeyword{llx} & length & 0pt & \pageref{psgraphoptions}\\
\Lkeyword{lly} & length & 0pt & \pageref{psgraphoptions}\\
\Lkeyword{logLines} & \Lkeyval{none}|\Lkeyval{x}|\Lkeyval{y}|\Lkeyval{all}
& \Lkeyval{none} & \pageref{loglines}\\
\Lkeyword{mathLabel} & boolean & \false & \pageref{labelfontsize}\\
\Lkeyword{nEnd} & integer or empty & \{\} & \pageref{nxend}\\
\Lkeyword{nStart} & integer & 0 & \pageref{nxstart}\\
\Lkeyword{nStep} & integer & 1 & \pageref{nxstep}\\
\Lkeyword{plotNo} & integer & 1 & \pageref{plotno}\\
\Lkeyword{plotNoMax} & integer & 1 & \pageref{plotno}\\
\Lkeyword{plotstyle} & style & \Lkeyval{line} & \pageref{plotstyle}\\
\Lkeyword{polarplot} & boolean & \false & \pageref{polarplots}\\
\Lkeyword{PSfont} & PS font & \Lkeyval{Times-Romasn} & \pageref{values}\\
\Lkeyword{psgrid} & boolean & \false & \pageref{psgrid}\\
\Lkeyword{quadrant} & integer & 4 & \pageref{quadrant}\\
\Lkeyword{subtickcolor} & color & \Lkeyval{darkgray} & \pageref{tickcolor}\\
\Lkeyword{subticklinestyle} & \Lkeyval{solid}|\Lkeyval{dashed}|\Lkeyval{dotted}|\Lkeyval{none}
& \Lkeyval{solid}&\pageref{ticklinestyle}\\
\Lkeyword{subticks} & integer & 0 & \pageref{subticks}\\
\Lkeyword{subticksize} & real & 0.75 & \pageref{subticksize}\\
\Lkeyword{subtickwidth} & length & 0.5\Lcs{pslinewidth} & \pageref{tickwidth}\\
\Lkeyword{tickcolor} & color & black & \pageref{tickcolor}\\
\Lkeyword{ticklinestyle} & \Lkeyval{solid}|\Lkeyval{dashed}|\Lkeyval{dotted}|\Lkeyval{none}
& \Lkeyval{solid}&\pageref{ticklinestyle}\\
\Lkeyword{ticks} & \Lkeyval{all}|\Lkeyval{x}|\Lkeyval{y}|\Lkeyval{none}
& \Lkeyval{all} & \pageref{ticks}\\%ok
\Lkeyword{ticksize} & length \OptArg{length} & -4pt 4pt & \pageref{ticksize}\\
\Lkeyword{tickstyle} & \Lkeyval{full}|\Lkeyval{top}|\Lkeyval{bottom}|\Lkeyval{inner} & full & \pageref{tickstyle}\\%ok
\Lkeyword{tickwidth} & length & 0.5\Lcs{pslinewidth} & \pageref{tickwidth}\\
\Lkeyword{trigLabelBase} & integer & 0 & \pageref{triglabels}\\
\Lkeyword{trigLabels} & boolean & \false & \pageref{triglabels}\\
\Lkeyword{urx} & length & 0pt & \pageref{psgraphoptions}\\
\Lkeyword{ury} & length & 0pt & \pageref{psgraphoptions}\\
\Lkeyword{valuewidth} & integer & 10 & \pageref{values}\\
\Lkeyword{xAxis} & boolean & \true & \pageref{xyAxes}\\%ok
\Lkeyword{xAxisLabel} & literal & \{\nxLcs{@empty}\} & \pageref{psgraphoptions}\\
\Lkeyword{xAxisLabelPos} & (x,y) or empty & \{\nxLcs{@empty}\} & \pageref{psgraphoptions}\\
\Lkeyword{xDecimals} & integer or empty & \{\} & \pageref{xydecimals}\\%ok
\Lkeyword{xEnd} & integer or empty & \{\} & \pageref{nxend}\\
\Lkeyword{xLabels} & list & \{\nxLcs{empty}\} & \pageref{xLabels}\\
\Lkeyword{xlabelFactor} & anything & \{\nxLcs{@empty}\} & \pageref{labelfactor}\\
\Lkeyword{xlabelFontSize} & macro & \{\} & \pageref{labelfontsize}\\
\Lkeyword{xlabelOffset} & length & 0 & \pageref{labelOffset}\\
\Lkeyword{xlabelPos} & \Lkeyval{bottom},\Lkeyval{axis},\Lkeyval{top}
& \Lkeyval{bottom} & \pageref{labelpos}\\
\Lkeyword{xLabelsRot} & angle & 0 & \pageref{xLabels}\\
\Lkeyword{xlogBase} & integer or empty & \{\} & \pageref{xlogbase}\\
\Lkeyword{xmathLabel} & boolean & \false & \pageref{labelfontsize}\\
\Lkeyword{xticklinestyle} & \Lkeyval{solid}|\Lkeyval{dashed}|\Lkeyval{dotted}|\Lkeyval{none}
& \Lkeyval{solid} & \pageref{ticklinestyle}\\
\Lkeyword{xStart} & integer or empty & \{\} & \pageref{nxstart}\\
\Lkeyword{xStep} & integer & 0 & \pageref{nxstep}\\
\Lkeyword{xsubtickcolor} & color & \Lkeyval{darkgray} & \pageref{tickcolor}\\
\Lkeyword{xsubticklinestyle}& \Lkeyval{solid}|\Lkeyval{dashed}|\Lkeyval{dotted}|\Lkeyval{none}
& \Lkeyval{solid} & \pageref{ticklinestyle}\\
\Lkeyword{xsubticks} & integer & 0 & \pageref{subticks}\\
\Lkeyword{xsubticksize} & real & 0.75 & \pageref{subticksize}\\
\Lkeyword{xtickcolor} & color & \Lkeyval{black} & \pageref{tickcolor}\\
\Lkeyword{xticksize} & length \OptArg{length} & -4pt 4pt & \pageref{ticksize}\\
\Lkeyword{xtrigLabels} & boolean & \false & \pageref{xtriglabels}\\
\Lkeyword{xtrigLabelBase} & integer & 0 & \pageref{triglabels}\\
\Lkeyword{xyAxes} & boolean & \true & \pageref{xyAxes}\\%ok
\Lkeyword{xyDecimals} & integer or empty & \{\} & \pageref{xydecimals}\\%ok
\Lkeyword{xylogBase} & integer or empty & \{\} & \pageref{xylogbase}\\
\Lkeyword{yAxis} & boolean & \true & \pageref{xyAxes}\\%ok
\Lkeyword{yAxisLabel} & literal & \{\nxLcs{@empty}\} & \pageref{psgraphoptions}\\
\Lkeyword{yAxisLabelPos} & (x,y) or empty & \{\nxLcs{@empty}\} & \pageref{psgraphoptions}\\
\Lkeyword{yDecimals} & integer or empty & \{\} & \pageref{xydecimals}\\%ok
\Lkeyword{yEnd} & integer or empty & \{\} & \pageref{ystartend}\\
\Lkeyword{yLabels} & list & \{\nxLcs{empty}\} & \pageref{xLabels}\\
\Lkeyword{ylabelFactor} & literal & \{nx\Lcs{empty}\} & \pageref{labelfactor}\\
\Lkeyword{ylabelFontSize} & macro & \{\} & \pageref{labelfontsize}\\
\Lkeyword{ylabelOffset} & length & 0 & \pageref{labelOffset}\\
\Lkeyword{ylabelPos} & \Lkeyval{left}|\Lkeyval{axis}|\Lkeyval{right}
& \Lkeyval{left} & \pageref{labelpos}\\
\Lkeyword{xLabelsRot} & angle & 0 & \pageref{xLabels}\\
\Lkeyword{ylogBase} & integer or empty & \{\} & \pageref{ylogbase}\\
\Lkeyword{ymathLabel} & boolean & \false & \pageref{labelfontsize}\\
\Lkeyword{yMaxValue} & real & 1.e30 & \pageref{yMaxValue}\\
\Lkeyword{yMinValue} & real & -1.e30 & \pageref{yMaxValue}\\
\Lkeyword{yStart} & integer or empty & \{\} & \pageref{ystartend}\\
\Lkeyword{yStep} & integer & 0 & \pageref{nxstep}\\
\Lkeyword{ysubtickcolor} & <color> & darkgray & \pageref{tickcolor}\\
\Lkeyword{ysubticklinestyle}& \Lkeyval{solid}|\Lkeyval{dashed}|\Lkeyval{dotted}|\Lkeyval{none}
& \Lkeyval{solid} &\pageref{ticklinestyle}\\
\Lkeyword{ysubticks} & integer & 0 & \pageref{subticks}\\
\Lkeyword{ysubticksize} & real & 0.75 & \pageref{subticksize}\\
\Lkeyword{ytickcolor} & color> & \Lkeyval{black} & \pageref{tickcolor}\\
\Lkeyword{yticklinestyle} & \Lkeyval{solid}|\Lkeyval{dashed}|\Lkeyval{dotted}|\Lkeyval{none}
& \Lkeyval{solid} &\pageref{ticklinestyle}\\
\Lkeyword{yticksize} & length \OptArg{length} & -4pt 4pt & \pageref{ticksize}\\
\Lkeyword{ytrigLabels} & boolean & \false & \pageref{ytriglabels}\\
\Lkeyword{ytrigLabelBase} & integer & 0 & \pageref{triglabels}\\
\end{longtable}
}
\clearpage
%-------------------------------------------------------------------------------------------
\subsection{Option \nxLkeyword{plotstyle} (Christoph Bersch)}\label{plotstyle}
%-------------------------------------------------------------------------------------------
\xLkeyword{plotstyle}\xLkeyval{cspline}
There is a new value \Lkeyval{cspline} for the plotstyle to interpolate a curve with cubic splines.
%
\begin{LTXexample}[pos=b]
\readdata{\foo}{data/data1.dat}
\begin{psgraph}[axesstyle=frame,ticksize=6pt,subticks=5,ury=1cm,
Ox=250,Dx=10,Oy=-2,](250,-2)(310,0.2){0.8\linewidth}{0.3\linewidth}
\listplot[plotstyle=cspline,linecolor=red,linewidth=0.5pt,showpoints]{\foo}
\end{psgraph}
\end{LTXexample}
\vspace{1cm}
%-------------------------------------------------------------------------------------------
\subsection{Option \nxLkeyword{xLabels}, \nxLkeyword{yLabels},
\nxLkeyword{xLabelsrot}, and \nxLkeyword{yLabelsrot}}\label{xLabels}
%-------------------------------------------------------------------------------------------
\xLkeyword{xLabels}\xLkeyword{yLabels}\xLkeyword{xLabelsRot}\xLkeyword{yLabelsRot}
\begin{LTXexample}[pos=b]
\psset{xunit=0.75}
\begin{pspicture}(-2,-2)(14,4)
\psaxes[xLabels={,Kerry,Laois,London,Waterford,Clare,Offaly,Galway,Wexford,%
Dublin,Limerick,Tipperary,Cork,Kilkenny},xLabelsRot=45,
yLabels={,low,medium,high},mathLabel=false](14,4)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[pos=b]
\begin{pspicture}(-0.5,-1.5)(1.5,1.5)
\psaxes[showorigin=false,yLabels={a,b,c}](0,0)(0,-1)(1,1)
\end{pspicture}
\begin{pspicture}(-0.5,-0.5)(1.5,2.5)
\psaxes[showorigin=false,yLabels={a,b,c}](1,2)
\end{pspicture}
\begin{pspicture}(-0.5,-2.5)(1.5,.5)
\psaxes[showorigin=false,yLabels={a,b,c}](0,0)(0,-2)(1,0)
\end{pspicture}
\begin{pspicture}(-1.5,-1.5)(1.5,1.5)
\psaxes[showorigin=false,xLabels={a,b,c}](0,0)(-1,-1)(1,1)
\end{pspicture}
\begin{pspicture}(-0.5,-0.5)(1.5,2.5)
\psaxes[showorigin=false,xLabels={a,b,c}](2,2)
\end{pspicture}
\begin{pspicture}(-2.5,-2.5)(1.5,.5)
\psaxes[showorigin=false,xLabels={a,b,c}](0,0)(-2,-2)(0,0)
\end{pspicture}
\end{LTXexample}
The values for \Lkeyword{xlabelsep} and \Lkeyword{ylabelsep} are taken into account.
\subsection{Option \nxLkeyword{xLabelOffset} and \nxLkeyword{ylabelOffset}}\label{labelOffset}
\begin{LTXexample}[width=7cm]
\psset{xAxisLabel=,yAxisLabel=,
llx=-5mm,urx=1cm,lly=-5mm,
mathLabel=false,xlabelsep=-5pt,
xLabels={A,b,C,d,E,f}}
\begin{psgraph}{->}(5,2){6cm}{2cm}
\end{psgraph}
\end{LTXexample}
\xLkeyword{xlabelOffset}\xLkeyword{xLabels}\xLkeyword{xlabelsep}\xLkeyword{mathLabel}
\begin{LTXexample}[width=7cm]
\psset{xAxisLabel=,yAxisLabel=,
llx=-5mm,urx=1cm,lly=-5mm,
mathLabel=false,xlabelsep=-5pt,
xLabels={,A,b,C,d,E},
xlabelOffset=-0.5,
ylabelOffset=0.5}
\begin{psgraph}{->}(5,2){6cm}{2cm}
\end{psgraph}
\end{LTXexample}
%------------------------------------------------------------------------------------
\subsection{Option \nxLkeyword{yMaxValue} and \nxLkeyword{yMinValue}}\label{yMaxValue}
%------------------------------------------------------------------------------------
With the new optional arguments \Lkeyword{yMaxValue} and
\Lkeyword{yMinValue} one can control the behaviour of
discontinuous functions, like the tangent function. The
code does not check that \Lkeyword{yMaxValue} is bigger than
\Lkeyword{yMinValue} (if not, the function is {\em not} plotted at all).
All four possibilities can be used, i.e. one, both or none of the
two arguments \Lkeyword{yMaxValue} and \Lkeyword{yMinValue} can
be set.
\begin{lstlisting}
\begin{pspicture}(-6.5,-6)(6.5,7.5)
\multido{\rA=-4.71239+\psPiH}{7}{%
\psline[linecolor=black!20,linestyle=dashed](\rA,-5.5)(\rA,6.5)}
\psset{algebraic,plotpoints=10000,plotstyle=line}
\psaxes[trigLabelBase=2,dx=\psPiH,xunit=\psPi,trigLabels]
{->}(0,0)(-1.7,-5.5)(1.77,6.5)[$x$,0][$y$,-90]
\psclip{\psframe[linestyle=none](-4.55,-5.5)(5.55,6.5)}
\psplot[?\ON?yMaxValue=6,yMinValue=-5?\OFF?,linewidth=2pt,linecolor=red]{-4.55}{4.55}{(x)/(sin(2*x))}
\endpsclip
\psplot[linestyle=dashed,linecolor=blue!30]{-4.8}{4.8}{x}
\psplot[linestyle=dashed,linecolor=blue!30]{-4.8}{4.8}{-x}
\rput(0,0.5){$\times$}
\end{pspicture}
\end{lstlisting}
\begingroup
\begin{pspicture}(-6.5,-6)(6.5,7.5)
\multido{\rA=-4.71239+\psPiH}{7}{%
\psline[linecolor=black!20,linestyle=dashed](\rA,-5.5)(\rA,6.5)}
\psset{algebraic,plotpoints=10000,plotstyle=line}
\psaxes[trigLabelBase=2,dx=\psPiH,xunit=\psPi,trigLabels]
{->}(0,0)(-1.7,-5.5)(1.77,6.5)[$x$,0][$y$,-90]
\psclip{\psframe[linestyle=none](-4.55,-5.5)(5.55,6.5)}
\psplot[yMaxValue=6,yMinValue=-5,linewidth=2pt,linecolor=red]{-4.55}{4.55}{(x)/(sin(2*x))}
\endpsclip
\psplot[linestyle=dashed,linecolor=blue!30]{-4.8}{4.8}{x}
\psplot[linestyle=dashed,linecolor=blue!30]{-4.8}{4.8}{-x}
\rput(0,0.5){$\times$}
\end{pspicture}
\endgroup
\begingroup
\begin{pspicture}(-6.5,-4)(6.5,7.5)
\psaxes[trigLabelBase=2,dx=\psPiH,
xunit=\psPi,trigLabels]{->}(0,0)(-1.7,-3.5)(1.77,6.5)[$x$,0][$y$,90]
\psplot[yMaxValue=6,yMinValue=-3,linewidth=1.6pt,plotpoints=2000,
linecolor=red,algebraic]{-4.55}{4.55}{tan(x)}
\end{pspicture}
\endgroup
\begin{lstlisting}
\begin{pspicture}(-6.5,-4)(6.5,7.5)
\psaxes[trigLabelBase=2,dx=\psPiH,xunit=\psPi,trigLabels]%
{->}(0,0)(-1.7,-3.5)(1.77,6.5)[$x$,0][$y$,90]
\psplot[yMaxValue=6,yMinValue=-3,linewidth=1.6pt,plotpoints=2000,
linecolor=red,algebraic]{-4.55}{4.55}{tan(x)}
\end{pspicture}
\end{lstlisting}
%--------------------------------------------------------------------------------------
\subsection{Option \nxLkeyword{axesstyle}}\label{axesstyle}\label{quadrant}
%--------------------------------------------------------------------------------------
There is a new axes style \Lkeyval{polar} which plots a \Index{polar coordinate} system.
Syntax:
\begin{lstlisting}[style=syntax]
\psplot[axesstyle=polar](Rx,Angle)
\psplot[axesstyle=polar](...)(Rx,Angle)
\psplot[axesstyle=polar](...)(...)(Rx,Angle)
\end{lstlisting}
Important is the fact, that only one pair of coordinates is taken into account for
the radius and the angle. It is \emph{always} the last pair in a sequence of allowed coordinates
for the \Lcs{psaxes} macro. The other ones are ignored; they are not valid for the
polar coordinate system. However, if the angle is set to 0 it is changed to 360 degrees for a
full circle.
\begin{LTXexample}[pos=r]
\begin{pspicture}(-1,-1)(5.75,5.75)
\psaxes[axesstyle=polar,
subticks=2](5,90)
\psline[linewidth=2pt]{->}(5;15)
\psline[linewidth=2pt]{->}(2;40)
\psline{->}(2;10)(4;85)
\end{pspicture}
\end{LTXexample}
All valid optional arguments for the axes are also possible for the polar style, if they make sense \ldots\ :-)
Important are the \Lkeyword{Dy} option, it defines the angle interval and \Lkeyword{subticks}, for
the intermediate circles and lines. The number can be different for the circles (\Lkeyword{ysubticks}) and the
lines (\Lkeyword{xsubticks}).
\begin{LTXexample}[pos=r]
\begin{pspicture}(-3,-1)(4.5,4.5)
\psaxes[axesstyle=polar,
subticklinestyle=dashed,
subticks=2,Dy=20,Oy=20,
ylabelFactor=^\circ](4,140)
\psline[linewidth=2pt]{->}(4;15)
\psline[linewidth=2pt]{->}(2;40)
\psline{->}(2;10)(3;85)
\end{pspicture}
\end{LTXexample}
\begin{lstlisting}
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psaxes[axesstyle=polar](3,0)
\psplot[polarplot,algebraic,linecolor=blue,linewidth=2pt,
plotpoints=2000]{0}{TwoPi 4 mul}{2*(sin(x)-x)/(cos(x)+x)}
\end{pspicture}
%
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psaxes[axesstyle=polar,subticklinestyle=dashed,subticks=2,
xlabelFontSize=\scriptstyle](3,360)
\psplot[polarplot,algebraic,linecolor=red,linewidth=2pt,
plotpoints=2000]{0}{TwoPi}{6*sin(x)*cos(x)}
\end{pspicture}
\end{lstlisting}
%\begin{LTXexample}[pos=b]
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psaxes[axesstyle=polar](3,0)
\psplot[polarplot,algebraic,linecolor=blue,linewidth=2pt,
plotpoints=2000]{0}{TwoPi 4 mul}{2*(sin(x)-x)/(cos(x)+x)}
\end{pspicture}
%
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psaxes[axesstyle=polar,subticklinestyle=dashed,subticks=2,
ylabelFontSize=\scriptstyle](3,360)
\psplot[polarplot,algebraic,linecolor=red,linewidth=2pt,
plotpoints=2000]{0}{TwoPi}{6*sin(x)*cos(x)}
\end{pspicture}
%\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection{Option \nxLkeyword{xyAxes}, \nxLkeyword{xAxis} and \nxLkeyword{yAxis}}\label{xyAxes}
%--------------------------------------------------------------------------------------
Syntax:
\begin{lstlisting}[style=syntax]
xyAxes=true|false
xAxis=true|false
yAxis=true|false
\end{lstlisting}
Sometimes there is only a need for one axis with ticks. In this
case you can set one of the preceding options to false. The
\Lkeyword{xyAxes} only makes sense when you want to set both x and y
to true with only one command, back to the default, because with
\Lkeyword{xyAxes}=\false you get nothing with the \Lcs{psaxes} macro.
\begin{LTXexample}
\begin{pspicture}(5,1)
\psaxes[yAxis=false,linecolor=blue]{->}(0,0.5)(5,0.5)
\end{pspicture}
\begin{pspicture}(1,5)
\psaxes[xAxis=false,linecolor=red]{->}(0.5,0)(0.5,5)
\end{pspicture}
\begin{pspicture}(1,5)
\psaxes[xAxis=false,linecolor=red,
ylabelPos=right]{->}(0.5,0)(0.5,5)
\end{pspicture}\\[0.5cm]
\begin{pspicture}(5,1)
\psaxes[yAxis=false,linecolor=blue,
xlabelPos=top]{->}(0,0.5)(5,0.5)
\end{pspicture}
\end{LTXexample}
As seen in the example, a single y axis gets the labels on the left side. This can be
changed with the option \Lkeyword{ylabelPos} or with \Lkeyword{xlabelPos} for the
$x$-axis.
%--------------------------------------------------------------------------------------
\subsection{Option \nxLkeyword{labels}}\label{labels}
%--------------------------------------------------------------------------------------
Syntax:
\begin{lstlisting}[style=syntax]
labels=all|x|y|none
\end{lstlisting}
This option was already in the \LPack{pst-plot} package and
only mentioned here for completeness.
\begin{LTXexample}[width=3.5cm]
\psset{ticksize=6pt}
\begin{pspicture}(-1,-1)(2,2)
\psaxes[labels=all,subticks=5]{->}(0,0)(-1,-1)(2,2)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\begin{pspicture}(-1,-1)(2,2)
\psaxes[labels=y,subticks=5]{->}(0,0)(-1,-1)(2,2)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\begin{pspicture}(-1,-1)(2,2)
\psaxes[labels=x,subticks=5]{->}(0,0)(2,2)(-1,-1)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\begin{pspicture}(-1,-1)(2,2)
\psaxes[labels=none,subticks=5]{->}(0,0)(2,2)(-1,-1)
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{xlabelPos} and \nxLkeyword{ylabelPos}}\label{labelpos}
%--------------------------------------------------------------------------------------
Syntax:
\begin{lstlisting}[style=syntax]
xlabelPos=bottom|axis|top
ylabelPos=left|axis|right
\end{lstlisting}
By default the \Index{label}s for ticks are placed at the bottom (x axis)
and left (y-axis). If both axes are drawn in the negative
direction the default is top (x axis) and right (y axis). It be
changed with the two options \Lkeyword{xlabelPos} and
\Lkeyword{ylabelPos}. With the value \Lkeyval{axis} the user can
place the labels depending on the value of \Lkeyword{labelsep}, which is
taken into account for \Lkeyval{axis}.
\bigskip
\begin{LTXexample}[width=9cm]
\begin{pspicture}(3,3)
\psaxes{->}(3,3)
\end{pspicture}\hspace{2cm}
\begin{pspicture}(3,-3)
\psaxes[xlabelPos=top]{->}(3,-3)
\end{pspicture}
\end{LTXexample}
\vspace{1cm}
\begin{LTXexample}[width=9cm]
\begin{pspicture}(-3,-3)
\psaxes{->}(-3,-3)
\end{pspicture}\hspace{2cm}
\begin{pspicture}(3,3)
\psaxes[labelsep=0pt,
ylabelPos=axis,
xlabelPos=axis]{->}(3,3)
\end{pspicture}
\end{LTXexample}
\vspace{1cm}
\begin{LTXexample}[width=5cm]
\begin{pspicture}(-1,1)(3,-3)
\psaxes[xlabelPos=top,
xticksize=0 20pt,
yticksize=-20pt 0]{->}(3,-3)
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{x|ylabelFontSize} and \nxLkeyword{x|ymathLabel}}\label{labelfontsize}
%--------------------------------------------------------------------------------------
This option sets the horizontal \textbf{and} vertical font size
for the labels depending on the option \Lkeyword{mathLabel} (\Lkeyword{xmathLabel}/\Lkeyword{ymathLabel}) for the
text or the math mode. It will be overwritten when another package
or a user defines
\begin{lstlisting}[style=syntax]
\def\pshlabel#1{\xlabelFontSize ...}
\def\psvlabel#1{\ylabelFontSize ...}
\def\pshlabel#1{$\xlabelFontSize ...$}% for mathLabel=true (default)
\def\psvlabel#1{$\ylabelFontSize ...$}% for mathLabel=true (default)
\end{lstlisting}
in another way. Note that for \Lkeyword{mathLabel}=\true the font size
must be set by one of the mathematical styles \Lcs{textstyle},
\Lcs{displaystyle}, \Lcs{scriptstyle}, or \Lcs{scriptscriptstyle}.
\begin{LTXexample}[width=6cm]
\psset{mathLabel=false}
\begin{pspicture}(-0.25,-0.25)(5,2.25)
\psaxes{->}(5,2.25)[$x$,0][$y$,90]
\end{pspicture}\\[20pt]
\begin{pspicture}(-0.25,-0.25)(5,2.25)
\psaxes[labelFontSize=\footnotesize]{->}(5,2.25)
\end{pspicture}\\[20pt]
\begin{pspicture}(-0.25,-0.25)(5,2.25)
\psaxes[xlabelFontSize=\footnotesize]{->}(5,2.25)
\end{pspicture}\\[20pt]
\end{LTXexample}
\begin{LTXexample}[width=6cm]
\begin{pspicture}(-0.25,-0.25)(5,2.25)
\psaxes[labelFontSize=\scriptstyle]{->}(5,2.25)[\textbf{x},-90][\textbf{y},0]
\end{pspicture}\\[20pt]
\psset{mathLabel=true}
\begin{pspicture}(-0.25,-0.25)(5,2.25)
\psaxes[ylabelFontSize=\scriptscriptstyle]{->}(5,2.25)
\end{pspicture}\\[20pt]
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{xlabelFactor} and \nxLkeyword{ylabelFactor}}\label{labelfactor}
%--------------------------------------------------------------------------------------
When having big numbers as data records then it makes sense to
write the values as ${<number>\cdot 10^{<exp>}}$. These new
options allow you to define the additional part of the value, but
it must be set in math mode when using math operators or macros like \Lcs{cdot}!
\begin{LTXexample}[pos=b]
\readdata{\data}{data/demo1.data}
\pstScalePoints(1,0.000001){}{}% (x,y){additional x operator}{y op}
\psset{llx=-1cm,lly=-1cm}
\psgraph[ylabelFactor=\cdot 10^6,Dx=5,Dy=100](0,0)(25,750){8cm}{5cm}
\listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data}
\endpsgraph
\pstScalePoints(1,1){}{}% reset
\end{LTXexample}
\begin{LTXexample}[pos=t]
\psset{xunit=0.05, yunit=2,labelFontSize=\scriptstyle,algebraic,plotpoints=500}
\newpsstyle{mygrid}{%
Dx=10,Dy=0.5,labels=none,subticks=5,tickwidth=0.4pt,subtickwidth=0.2pt,
tickcolor=Red!30,subtickcolor=ForestGreen!30,
xticksize=-1 1.5,yticksize=0 180,subticksize=1}
\begin{pspicture}(-10,-1.3)(190,1.8)
\psaxes[style=mygrid](0,0)(0,-1)(180,1.51)
\psplot[linecolor=NavyBlue]{0}{180}{sin(x*Pi/180)+1/2}
\psaxes[Dx=20,Dy=0.5,linecolor=gray,tickcolor=gray,linewidth=1pt,ticksize=-3pt 3pt,
xlabelFactor={}^\circ]{<->}(0,0)(-5,-1.2)(185,1.7)[$x$,0][$y$,90]
\end{pspicture}
\end{LTXexample}
\psset{unit=1cm}
\clearpage
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{decimalSeparator} and \nxLkeyword{comma}}\label{comma}
%--------------------------------------------------------------------------------------
Syntax:
\begin{lstlisting}[style=syntax]
comma=false|true
decimalSeparator=<charactor>
\end{lstlisting}
Setting the option \Lkeyword{comma} to true gives labels with a comma as a decimal separator instead
of the default dot. \Lkeyword{comma} and \verb|comma=true| is the same. The optional argument
\Lkeyword{decimalSeparator} allows an individual setting for languages with a different
character than a dot or a comma. The character has to be set into braces, if it is an
active one, e.\,g. \Lkeyword{decimalSeparator}=\Largb{,}.
\medskip
\begin{LTXexample}[width=5.5cm]
\begin{pspicture}(-0.5,-0.5)(5,5.5)
\psaxes[Dx=1.5,comma,Dy=0.75,dy=0.75]{->}(5,5)
\psplot[linecolor=red,linewidth=3pt]{0}{4.5}%
{x RadtoDeg cos 2 mul 2.5 add}
\psline[linestyle=dashed](0,2.5)(4.5,2.5)
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{xyDecimals}, \nxLkeyword{xDecimals} and \nxLkeyword{yDecimals}}\label{xydecimals}
%--------------------------------------------------------------------------------------
Syntax:
\begin{lstlisting}[style=syntax]
xyDecimals=<number>
xDecimals=<any>
yDecimals=<any>
\end{lstlisting}
By default the labels of the axes get numbers with or without
decimals, depending on the numbers itself. With these options
it is possible to determine the decimals, where
the option \Lkeyword{xyDecimals} sets this identical for both axes.
\Lkeyword{xDecimals} only for the $x$ and \Lkeyword{yDecimals} only
for the $y$ axis.
The default setting \verb|{}| means, that you'll get the standard
behaviour.
\begin{LTXexample}[width=6cm]
\begin{pspicture}(-1.5,-0.5)(5,3.75)
\psaxes[xyDecimals=2]{->}(0,0)(4.5,3.5)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[pos=t]
\psset{xunit=10cm,yunit=0.01cm,labelFontSize=\scriptstyle}
\begin{pspicture}(-0.1,-150)(1.5,550.0)
\psaxes[Dx=0.25,Dy=100,ticksize=-4pt 0,comma,xDecimals=3,yDecimals=1]{->}%
(0,0)(0,-100)(1.4,520)[\textbf{Amp\`ere},-90][\textbf{Voltage},0]
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection[Option \nxLkeyword{fractionLabels}]{Options \nxLkeyword{fractionLabels},
\nxLkeyword{xfractionLabels}, \nxLkeyword{yfractionLabels}, \nxLkeyword{fractionLabelBase}, \nxLkeyword{xfractionLabelBase},
and \nxLkeyword{yfractionLabelBase}}\label{fraclabels}
%--------------------------------------------------------------------------------------
With the option \Lkeyword{fractionLabels}=\true\ the labels on the axes
are set as fractions.
The option \Lkeyword{fractionLabelBase} sets the
denominator of fraction. The default value of 0 is the same as no
fraction.
\begin{LTXexample}[pos=t]
\psset{fractionLabels,fractionLabelBase=3,unit=3cm}
\begin{pspicture}(-2,-1)(2,1)
\psaxes[dx=0.333,dy=0.333](0,0)(-2,-1)(2,1)
\psplot[algebraic,plotpoints=100]{-2}{2}{0.4*x-1/3}
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection[Option \nxLkeyword{triglabels}]{Options \nxLkeyword{trigLabels},
\nxLkeyword{xtrigLabels}, \nxLkeyword{ytrigLabels}, \nxLkeyword{trigLabelBase}, \nxLkeyword{xtrigLabelBase},
and \nxLkeyword{ytrigLabelBase}
for an axis with trigonmetrical units}\label{triglabels}
%--------------------------------------------------------------------------------------
With the option \Lkeyword{trigLabels}=\true\ \emph{only} the labels on the $x$ axis
are trigonometrical ones. It is the same than setting \Lkeyword{xtrigLabels}=\true.
The option \Lkeyword{trigLabelBase} sets the
denominator of fraction. The default value of 0 is the same as no
fraction. The following constants are defined in the package:
\begin{lstlisting}[style=syntax]
\def?\ON?\psPiFour?\OFF?{12.566371}
\def?\ON?\psPiTwo?\OFF?{6.283185}
\def?\ON?\psPi?\OFF?{3.14159265}
\def?\ON?\psPiH?\OFF?{1.570796327}
\newdimen\pstRadUnit
\newdimen\pstRadUnitInv
?\ON?\pstRadUnit?\OFF?=1.047198cm % this is pi/3
?\ON?\pstRadUnitInv?\OFF?=0.95493cm % this is 3/pi
\end{lstlisting}
Because it is a bit complicated to set the right values, we show
some more examples here.
For \textbf{all} following examples in this section we did a
global
\begin{Xverbatim}{}
\psset{trigLabels,labelFontSize=\scriptstyle}
\end{Xverbatim}
\psset{trigLabels,labelFontSize=\scriptstyle} Translating the
decimal ticks to trigonometrical ones makes no real sense, because
every 1 xunit (1cm) is a tick and the last one is at 6cm.
\clearpage
\psset{unit=1cm}
\begin{minipage}{0.45\fullWidth}
\begin{pspicture}[trigLabels](-0.5,-1.25)(6.5,1.25)%
\pnode(5,0){A}%
\psaxes{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25)%
\end{pspicture}
\end{minipage}%
\begin{minipage}{0.55\fullWidth}
\begin{lstlisting}
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)%
\pnode(5,0){A}%
\psaxes{->}(0,0)(-.5,-1.25)(\psPiTwo,1.25)
\end{pspicture}
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.45\fullWidth}
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)%
\psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25)
\end{pspicture}
\end{minipage}%
\begin{minipage}{0.55\fullWidth}
\begin{lstlisting}
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)%
\psaxes[?\ON?trigLabelBase=3?\OFF?]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25)
\end{pspicture}
\end{lstlisting}
\end{minipage}
Modifying the ticks to have the last one exactly at the end is
possible with a different dx value ($\frac{\pi}{3}\approx 1.047$):
\begin{minipage}{0.45\fullWidth}
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(\psPiTwo,0){C}%
\psaxes[dx=\pstRadUnit]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25)
\end{pspicture}%
\end{minipage}%
\begin{minipage}{0.55\fullWidth}
\begin{lstlisting}
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(\psPiTwo,0){C}%
\psaxes[?\ON?dx=\pstRadUnit?\OFF?]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25)
\end{pspicture}%
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.45\fullWidth}
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(5,0){B}%
\psaxes[dx=\pstRadUnit,trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25)
\end{pspicture}%
\end{minipage}%
\begin{minipage}{0.55\fullWidth}
\begin{lstlisting}
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(5,0){B}%
\psaxes[dx=\pstRadUnit,?\ON?trigLabelBase=3?\OFF?] {->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25)
\end{pspicture}%
\end{lstlisting}
\end{minipage}
\ncline[linestyle=dashed,linewidth=0.4pt]{A}{B}
Set everything globally in radian units. Now 6 units on the
$x$-axis are $6\pi$. Using \Lkeyword{trigLabelBase}=3 reduces this
value to $2\pi$, a.s.o.
\bigskip
\begin{minipage}{0.45\fullWidth}
\psset{xunit=\pstRadUnit}%
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(6,0){D}%
\psaxes{->}(0,0)(-0.5,-1.25)(6.5,1.25)%
\end{pspicture}%
\end{minipage}%
\begin{minipage}{0.55\fullWidth}
\begin{lstlisting}
\psset{?\ON?xunit=\pstRadUnit?\OFF?}%
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(6,0){D}%
\psaxes{->}(0,0)(-0.5,-1.25)(6.5,1.25)%
\end{pspicture}%
\end{lstlisting}
\end{minipage}
\ncline[linestyle=dashed,linewidth=0.4pt]{C}{D}
\begin{minipage}{0.45\fullWidth}
\psset{xunit=\pstRadUnit}%
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)
\psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\end{pspicture}%
\end{minipage}%
\begin{minipage}{0.55\fullWidth}
\begin{lstlisting}
\psset{?\ON?xunit=\pstRadUnit?\OFF?}%
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)
\psaxes[?\ON?trigLabelBase=3?\OFF?]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\end{pspicture}%
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.45\fullWidth}
\psset{xunit=\pstRadUnit}%
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)
\psaxes[trigLabelBase=4]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\end{pspicture}%
\end{minipage}%
\begin{minipage}{0.55\fullWidth}
\begin{lstlisting}
\psset{?\ON?xunit=\pstRadUnit?\OFF?}%
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)
\psaxes[?\ON?trigLabelBase=4?\OFF?]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\end{pspicture}%
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.45\fullWidth}
\psset{xunit=\pstRadUnit}%
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)
\psaxes[trigLabelBase=6]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\end{pspicture}%
\end{minipage}%
\begin{minipage}{0.55\fullWidth}
\begin{lstlisting}
\psset{?\ON?xunit=\pstRadUnit?\OFF?}%
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)
\psaxes[?\ON?trigLabelBase=6?\OFF?]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\end{pspicture}%
\end{lstlisting}
\end{minipage}
The best way seems to be to set the $x$-unit to
\Lcs{pstRadUnit}. Plotting a function doesn't consider the value
for \Lkeyword{trigLabelBase}, it has to be done by the user. The first
example sets the unit locally for the \Lcs{psplot} back to 1cm,
which is needed, because we use this unit on the PostScript side.
\begin{minipage}{0.45\fullWidth}
\psset{xunit=\pstRadUnit}%
\begin{pspicture}(-0.4,-1.25)(6.5,1.25)
\psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\psplot[xunit=1cm,linecolor=red,linewidth=1.5pt]{0}{\psPiTwo}{x RadtoDeg sin}
\end{pspicture}
\end{minipage}%
\begin{minipage}{0.55\fullWidth}
\begin{lstlisting}
\psset{xunit=\pstRadUnit}%
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)
\psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\psplot[?\ON?xunit=1cm?\OFF?,linecolor=red,linewidth=1.5pt]{0}{?\ON?\psPiTwo?\OFF?}{x RadtoDeg sin}
\end{pspicture}
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.45\fullWidth}
\psset{xunit=\pstRadUnit}%
\begin{pspicture}(-0.4,-1.25)(6.5,1.25)
\psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\psplot[linecolor=red,linewidth=1.5pt]{0}{6}{x Pi 3 div mul RadtoDeg sin}
\end{pspicture}
\end{minipage}%
\begin{minipage}{0.55\fullWidth}
\begin{lstlisting}
\psset{xunit=\pstRadUnit}%
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)
\psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\psplot[linecolor=red,linewidth=1.5pt]{0}{6}{x ?\ON?Pi 3 div mul ?\OFF?RadtoDeg sin}
\end{pspicture}
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.45\fullWidth}
\psset{xunit=\pstRadUnit}%
\begin{pspicture}(-0.4,-1.25)(6.5,1.25)
\psaxes[dx=1.5]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\psplot[xunit=.5cm,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin}
\end{pspicture}
\end{minipage}%
\begin{minipage}{0.55\fullWidth}
\begin{lstlisting}
\psset{xunit=\pstRadUnit}%
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)
\psaxes[?\ON?dx=1.5?\OFF?]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\psplot[?\ON?xunit=0.5cm?\OFF?,linecolor=red,linewidth=1.5pt]{0}{?\ON?\psPiFour?\OFF?}{x RadtoDeg sin}
\end{pspicture}
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.45\fullWidth}
\psset{xunit=\pstRadUnit}%
\begin{pspicture}(-0.4,-1.25)(6.5,1.25)
\psaxes[dx=0.75,trigLabelBase=2]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\psplot[xunit=.5cm,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin}
\end{pspicture}
\end{minipage}%
\begin{minipage}{0.55\fullWidth}
\begin{lstlisting}
\psset{xunit=\pstRadUnit}%
\begin{pspicture}(-0.5,-1.25)(6.5,1.25)
\psaxes[?\ON?dx=0.75?\OFF?,?\ON?trigLabelBase=2?\OFF?]{->}(0,0)(-0.5,-1.25)(6.5,1.25)
\psplot[?\ON?xunit=0.5cm?\OFF?,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin}
\end{pspicture}
\end{lstlisting}
\end{minipage}
It is also possible to set the $x$ unit and $dx$ value to get the
labels right. But this needs some more understanding as to how it
really works. A \Lkeyword{xunit}=1.570796327 sets the unit to $\pi/2$
and a \Lkeyword{dx}=0.666667 then puts at every $2/3$ of the unit a
tick mark and a label. The length of the $x$-axis is 6.4 units
which is $6.4\cdot 1.570796327cm\approx 10cm$. The function then
is plotted from $0$ to $3\pi=9.424777961$.
\begin{center}
\psset{unit=1cm}
\begin{pspicture}(-0.5,-1.25)(10,1.25)
\psaxes[xunit=\psPiH,showorigin=false,trigLabelBase=3,dx=0.666667]{->}(0,0)(-0.5,-1.25)(6.4,1.25)
\psplot[linecolor=red,linewidth=1.5pt]{0}{9.424777961}{%
x RadtoDeg dup sin exch 1.1 mul cos add}
\end{pspicture}
\end{center}
\begin{lstlisting}
\begin{pspicture}(-0.5,-1.25)(10,1.25)
\psaxes[?\ON?xunit=\psPiH?\OFF?,?\ON?trigLabelBase=3?\OFF?,?\ON?dx=0.666667?\OFF?]{->}(0,0)(-0.5,-1.25)(6.4,1.25)
\psplot[linecolor=red,linewidth=1.5pt]{0}{?\ON?9.424777961?\OFF?}{%
x RadtoDeg dup sin exch 1.1 mul cos add}
\end{pspicture}
\end{lstlisting}
\begin{center}
\psset{unit=1cm}
\begin{pspicture}(-0.5,-1.25)(10,1.25)
\psaxes[xunit=\psPi,dx=0.25]{->}(0,0)(-0.25,-1.25)(3.2,1.25)
\psplot[xunit=0.25,plotpoints=500,linecolor=red,linewidth=1.5pt]{0}{37.70}{%
x RadtoDeg dup sin exch 1.1 mul cos add}
\end{pspicture}
\end{center}
\begin{lstlisting}
\psset{?\ON?unit=1cm?\OFF?}
\psplot[?\ON?xunit=0.25?\OFF?,?\ON?plotpoints=500?\OFF?,linecolor=red,linewidth=1.5pt]{0}{37.70}{%
x RadtoDeg dup sin exch 1.1 mul cos add}
\end{pspicture}
\end{lstlisting}
\begin{center}
\psset{unit=1cm}
\begin{pspicture}(-0.5,-2)(10,2)
\psplot[xunit=0.0625,linecolor=red,linewidth=1.5pt,plotpoints=5000]{0}{150.80}{%
x RadtoDeg dup sin exch 1.1 mul cos add}
\psaxes[xunit=\psPi,dx=0.5,Dx=8,subticks=2]{->}(0,0)(-0.1,-2)(3.2,2)
\end{pspicture}
\end{center}
\begin{lstlisting}
\psset{?\ON?unit=1cm?\OFF?}
\begin{pspicture}(-0.5,-1.25)(10,1.25)
\psplot[?\ON?xunit=0.0625?\OFF?,linecolor=red,linewidth=1.5pt,%
?\ON?plotpoints=5000?\OFF?]{0}{150.80}%
{x RadtoDeg dup sin exch 1.1 mul cos add}
\psaxes[?\ON?xunit=\psPi?\OFF?,?\ON?dx=0.5?\OFF?,?\ON?Dx=8?\OFF?]{->}(0,0)(-0.25,-1.25)(3.2,1.25)
\end{pspicture}
\end{lstlisting}
\begin{center}
\psset{unit=1cm}
\begin{pspicture}(-7,-1.5)(7,1.5)
\psaxes[trigLabels=true,xunit=\psPi]{->}(0,0)(-2.2,-1.5)(2.2,1.5)
\psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin}
\end{pspicture}
\end{center}
\begin{lstlisting}
\begin{pspicture}(-7,-1.5)(7,1.5)
\psaxes[trigLabels=true,?\ON?xunit=\psPi?\OFF?]{->}(0,0)(-2.2,-1.5)(2.2,1.5)
\psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin}
\end{pspicture}
\end{lstlisting}
\begin{center}
\psset{unit=1cm}
\begin{pspicture}(-7,-1.5)(7,1.5)
\psaxes[trigLabels=true,
trigLabelBase=2,dx=\psPiH,xunit=\psPi]{->}(0,0)(-2.2,-1.5)(2.2,1.5)
\psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin}
\end{pspicture}
\end{center}
\begin{lstlisting}
\begin{pspicture}(-7,-1.5)(7,1.5)
\psaxes[trigLabels=true,
trigLabelBase=2,dx=\psPiH,xunit=\psPi]{->}(0,0)(-2.2,-1.5)(2.2,1.5)
\psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin}
\end{pspicture}
\end{lstlisting}
\psset{unit=1cm,trigLabels=false}
The setting of trigonometrical labels with \Lkeyword{ytriglabels}=\true\
for the $y$ axis is the same as for the $x$ axis.
\label{xtriglabels}\label{ytriglabels}
\begin{center}
\psset{unit=1cm}
\begin{pspicture}(-6.5,-7)(6.5,7.5)
\psaxes[trigLabelBase=2,dx=\psPiH,xunit=\psPi,ytrigLabels]
{->}(0,0)(-1.7,-6.5)(1.77,6.5)[$x$,0][$y$,90]
\end{pspicture}
\end{center}
\begin{lstlisting}
\psset{unit=1cm}
\begin{pspicture}(-6.5,-7)(6.5,7.5)
\psaxes[trigLabelBase=2,dx=\psPiH,xunit=\psPi,ytrigLabels]
{->}(0,0)(-1.7,-6.5)(1.77,6.5)[$x$,0][$y$,90]
\end{pspicture}
\end{lstlisting}
Also setting labels for the $x$ axis is possible with \Lkeyword{trigLabels}=\true\
or alternatively with \Lkeyword{ytrigLabels}=\true.
\begin{center}
\psset{unit=1cm}
\begin{pspicture}(-6.5,-7)(6.5,7.5)
\psaxes[trigLabels,xtrigLabelBase=2,ytrigLabelBase=3,dx=\psPiH,
xunit=\psPi,Dy=2]{->}(0,0)(-1.7,-6.5)(1.77,6.5)[$x$,0][$y$,90]
\end{pspicture}
\end{center}
\begin{lstlisting}
\psset{unit=1cm}
\begin{pspicture}(-6.5,-7)(6.5,7.5)
\psaxes[trigLabels,xtrigLabelBase=2,ytrigLabelBase=3,dx=\psPiH,
xunit=\psPi,Dy=2]{->}(0,0)(-1.7,-6.5)(1.77,6.5)[$x$,0][$y$,90]
\end{pspicture}
\end{lstlisting}
\clearpage
\psset{yAxis=false,xtrigLabels,xtrigLabelBase=3}
\begin{pspicture}(-\psPi,-5mm)(\psPiTwo,12pt)
\def\pi{\omega}% Hold it local
\psaxes[dx=\pstRadUnit,Ox=-3](-\psPi,-12pt)(\psPiTwo,12pt)
\end{pspicture}
\bigskip
\begin{pspicture}(-\psPi,-5mm)(\psPiTwo,12pt)
\psaxes[dx=\pstRadUnit,Ox=-3](-\psPi,-12pt)(\psPiTwo,12pt)
\end{pspicture}
\bigskip
\begin{pspicture}(-\psPi,-5mm)(\psPiTwo,12pt)
\def\pi{\sqrt2}% Hold it local
\psaxes[dx=\pstRadUnit,Ox=-3](-\psPi,-12pt)(\psPiTwo,12pt)
\end{pspicture}
\bigskip
\psset{trigLabels=false}
\begin{pspicture}(-\psPi,-10mm)(\psPiTwo,12pt)
\psaxes[dx=\pscalculate{3.14/2},Dx=90,Ox=-180](-\psPi,-12pt)(\psPiTwo,12pt)
\end{pspicture}
\bigskip
\begin{lstlisting}
\begin{pspicture}(-\psPi,-5mm)(\psPiTwo,12pt)
\def\pi{\omega}% Hold it local
\psaxes[dx=\pstRadUnit,Ox=-3](-\psPi,-12pt)(\psPiTwo,12pt)
\end{pspicture}
\bigskip
\begin{pspicture}(-\psPi,-5mm)(\psPiTwo,12pt)
\psaxes[dx=\pstRadUnit,Ox=-3](-\psPi,-12pt)(\psPiTwo,12pt)
\end{pspicture}
\bigskip
\begin{pspicture}(-\psPi,-5mm)(\psPiTwo,12pt)
\def\pi{\sqrt2}% Hold it local
\psaxes[dx=\pstRadUnit,Ox=-3](-\psPi,-12pt)(\psPiTwo,12pt)
\end{pspicture}
\bigskip
\psset{trigLabels=false}
\begin{pspicture}(-\psPi,-10mm)(\psPiTwo,12pt)
\psaxes[dx=\pscalculate{3.14/2},Dx=90,Ox=-180](-\psPi,-12pt)(\psPiTwo,12pt)
\end{pspicture}
\end{lstlisting}
\psset{trigLabels=false,labelFontSize=\scriptstyle,unit=1cm}
\clearpage
%--------------------------------------------------------------------------------------
\subsection{Option \nxLkeyword{ticks}}\label{ticks}
%--------------------------------------------------------------------------------------
Syntax:
\begin{lstlisting}[style=syntax]
ticks=all|x|y|none
\end{lstlisting}
This option was already in the \LPack{pst-plot} package and
only mentioned here for some completeness.
\begin{LTXexample}[width=3.5cm]
\psset{ticksize=6pt}
\begin{pspicture}(-1,-1)(2,2)
\psaxes[ticks=all,subticks=5]{->}(0,0)(-1,-1)(2,2)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\begin{pspicture}(-1,-1)(2,2)
\psaxes[ticks=y,subticks=5]{->}(0,0)(-1,-1)(2,2)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\begin{pspicture}(-1,-1)(2,2)
\psaxes[ticks=x,subticks=5]{->}(0,0)(2,2)(-1,-1)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\begin{pspicture}(-1,-1)(2,2)
\psaxes[ticks=none,subticks=5]{->}(0,0)(2,2)(-1,-1)
\end{pspicture}
\end{LTXexample}
\clearpage
% full= 0, top=1, bottom=-1, inner=2 => -1 0 1 2
%--------------------------------------------------------------------------------------
\subsection{Option \nxLkeyword{tickstyle}}\label{tickstyle}
%--------------------------------------------------------------------------------------
Syntax:
\begin{lstlisting}[style=syntax]
tickstyle=full|top|bottom|inner
\end{lstlisting}
The value \Lkeyval{inner} is only possible for the axes style \Lkeyval{frame}.
\medskip
\begin{LTXexample}[pos=t]
\psset{subticks=10}
\begin{pspicture}(-1,-1)(3,3) \psaxes[tickstyle=full]{->}(3,3) \end{pspicture}
\begin{pspicture}(-1,-1)(3,3) \psaxes[tickstyle=top]{->}(3,3) \end{pspicture}
\begin{pspicture}(-1,-1)(3,3) \psaxes[tickstyle=bottom]{->}(3,3)\end{pspicture}
\begin{pspicture}(-1,-1)(3,3)
\psaxes[axesstyle=frame, tickstyle=inner, ticksize=0 4pt]{->}(3,3)
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{ticksize}, \nxLkeyword{xticksize}, \nxLkeyword{yticksize}}\label{ticksize}
%--------------------------------------------------------------------------------------
With this new option the recent \Lkeyword{tickstyle} option of
\LPack{pst-plot} is obsolete and no longer supported by \LPack{pstricks-add}.
Syntax:
\begin{lstlisting}[style=syntax]
ticksize=value[unit]
ticksize=value[unit] value[unit]
xticksize=value[unit]
xticksize=value[unit] value[unit]
yticksize=value[unit]
yticksize=value[unit] value[unit]
\end{lstlisting}
\Lkeyword{ticksize} sets both values. The first one is left/below and the optional second
one is right/above of the coordinate axis. The old setting \Lkeyset{tickstyle=bottom} is
now easy to realize, e.\,g.: \Lkeyword{ticksize}=-6pt 0, or vice versa, if the coordinates
are set from positive to negative values.
\medskip
\begin{LTXexample}[width=6cm]
\psset{arrowscale=2}
\begin{pspicture}(-1.5,-1.5)(4,3.5)
\psaxes[ticksize=0.5cm]{->}(0,0)(-1.5,-1.5)(4,3.5)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=6cm]
\psset{arrowscale=2}
\begin{pspicture}(-1.5,-1.5)(4,3.5)
\psaxes[xticksize=-10pt 0,yticksize=0 10pt]%
{->}(0,0)(-1.5,-1.5)(4,3.5)
\end{pspicture}
\end{LTXexample}
A grid is also possible by setting the values to the max/min coordinates.
\begin{LTXexample}[width=6cm]
\psset{arrowscale=2}
\begin{pspicture}(-.5,-.5)(5,4.5)
\psaxes[ticklinestyle=dashed,
ticksize=0 4cm]{->}(0,0)(-.5,-.5)(5,4.5)
\end{pspicture}
\end{LTXexample}
\clearpage
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{subticks}, \nxLkeyword{xsubticks}, and \nxLkeyword{ysubticks}}\label{subticks}
%--------------------------------------------------------------------------------------
Syntax:
\begin{lstlisting}[style=syntax]
subticks=<number>
xsubticks=<number>
ysubticks=<number>
\end{lstlisting}
By default \Lkeyword{subticks} cannot have labels.
\begin{LTXexample}[width=3.5cm]
\psset{ticksize=6pt}
\begin{pspicture}(-1,-1)(2,2)
\psaxes[ticks=all,xsubticks=5,
ysubticks=10]{->}(0,0)(-1,-1)(2,2)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\begin{pspicture}(-1,-1)(2,2)
\psaxes[ticks=y,subticks=5]{->}(0,0)(-1,-1)(2,2)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\begin{pspicture}(-1,-1)(2,2)
\psaxes[ticks=x,subticks=5]{->}(0,0)(2,2)(-1,-1)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\begin{pspicture}(-1,-1)(2,2)
\psaxes[ticks=none,subticks=5]{->}(0,0)(2,2)(-1,-1)
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{subticksize}, \nxLkeyword{xsubticksize}, \nxLkeyword{ysubticksize}}\label{subticksize}
%--------------------------------------------------------------------------------------
\Lkeyword{subticksize} sets both values, \Lkeyword{xsubticksize} only for the $x$-axis and
\Lkeyword{ysubticksize} only for the $y$-axis,
which must be relative to the ticksize length and
can have any number. 1 sets it to the same length as the main ticks.
Syntax:
\begin{lstlisting}[style=syntax]
subticksize=value
xsubticksize=value
ysubticksize=value
\end{lstlisting}
\begin{LTXexample}[preset=\centering,pos=t]
\psset{yunit=1.5cm,xunit=3cm}
\begin{pspicture}(-1.25,-4.75)(3.25,.75)
\psaxes[xticksize=-4.5 0.5,ticklinestyle=dashed,subticks=5,xsubticksize=1,%
ysubticksize=0.75,xsubticklinestyle=dotted,xsubtickwidth=1pt,
subtickcolor=gray]{->}(0,0)(-1,-4)(3.25,0.5)
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection[\nxLkeyword{tickcolor} and \nxLkeyword{subtickcolor}]%
{Options \nxLkeyword{tickcolor}, \nxLkeyword{xtickcolor}, \nxLkeyword{ytickcolor},
\nxLkeyword{subtickcolor}, \nxLkeyword{xsubtickcolor}, and \nxLkeyword{ysubtickcolor}}\label{tickcolor}
%--------------------------------------------------------------------------------------
Syntax:
\begin{lstlisting}[style=syntax]
tickcolor=<color>
xtickcolor=<color>
ytickcolor=<color>
subtickcolor=<color>
xsubtickcolor=<color>
ysubtickcolor=<color>
\end{lstlisting}
\Lkeyword{tickcolor} and \Lkeyword{subtickcolor} set both for the $x$- and the $y$-Axis.
\begin{LTXexample}[preset=\centering,pos=t]
\begin{pspicture}(0,-0.75)(10,1)
\psaxes[yAxis=false,labelFontSize=\scriptstyle,ticksize=0 10mm,subticks=10,subticksize=0.75,
tickcolor=red,subtickcolor=blue,tickwidth=1pt,subtickwidth=0.5pt](10.01,0)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=5cm]
\begin{pspicture}(5,-0.75)(10,1)
\psaxes[yAxis=false,labelFontSize=\scriptstyle,ticksize=0 -10mm,subticks=10,subticksize=0.75,
tickcolor=red,subtickcolor=blue,tickwidth=1pt,subtickwidth=0.5pt,Ox=5](5,0)(5,0)(10.01,0)
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection[\nxLkeyword{ticklinestyle} and \nxLkeyword{subticklinestyle}]%
{Options \nxLkeyword{ticklinestyle}, \nxLkeyword{xticklinestyle}, \nxLkeyword{yticklinestyle},
\nxLkeyword{subticklinestyle}, \nxLkeyword{xsubticklinestyle}, and \nxLkeyword{ysubticklinestyle}}\label{ticklinestyle}
%--------------------------------------------------------------------------------------
Syntax:
\begin{lstlisting}[style=syntax]
ticklinestyle=solid|dashed|dotted|none
xticklinestyle=solid|dashed|dotted|none
yticklinestyle=solid|dashed|dotted|none
subticklinestyle=solid|dashed|dotted|none
xsubticklinestyle=solid|dashed|dotted|none
ysubticklinestyle=solid|dashed|dotted|none
\end{lstlisting}
\Lkeyword{ticklinestyle} and \Lkeyword{subticklinestyle} set both values
for the x and y axis. The value \Lkeyval{none} doesn't really makes
sense, because it is the same as \verb+[sub]ticklines=0+
\xLkeyword{xticklinestyle}\xLkeyword{yticklinestyle}
\xLkeyword{xsubticklinestyle}\xLkeyword{ysubticklinestyle}
\begin{LTXexample}[preset=\centering,pos=t]
\psset{unit=4cm}
\pspicture(-0.15,-0.15)(2.5,1)
\psaxes[axesstyle=frame,logLines=y,xticksize=0 1,xsubticksize=1,ylogBase=10,
tickcolor=red,subtickcolor=blue,tickwidth=1pt,subticks=9,xsubticks=10,
xticklinestyle=dashed,xsubticklinestyle=dashed](2.5,1)
\endpspicture
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection{\nxLkeyword{logLines}}\label{loglines}
%--------------------------------------------------------------------------------------
Syntax:
\begin{BDef}
logLines=all|x|y
\end{BDef}
By default the option \Lkeyword{logLines} sets the ticksize to the maximal length for x, y, or both.
It can be changed, when \emph{after} the option \Lkeyword{logLines} the ticksize is set.
\begin{LTXexample}[pos=t]
\pspicture(-1,-1)(5,5)
\psaxes[subticks=5,xylogBase=10,logLines=all](5,5)
\endpspicture\hspace{1cm}
\pspicture(-1,-1)(5,5)
\psaxes[subticks=9,axesstyle=frame,xylogBase=10,logLines=all,
ticksize=0 5pt,tickstyle=inner](5,5)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[preset=\centering,pos=t]
\psset{unit=4cm}
\pspicture(-0.15,-0.15)(2.5,2)
\psaxes[axesstyle=frame,logLines=y,xticksize=max,xsubticksize=1,ylogBase=10,
tickcolor=red,subtickcolor=blue,tickwidth=1pt,subticks=9,xsubticks=10](2.5,2)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[preset=\centering,pos=t]
\psset{unit=4}
\pspicture(-0.5,-0.3)(3,1.2)
\psaxes[axesstyle=frame,tickstyle=inner,logLines=x,xlogBase=10,Dy=0.5,tickcolor=red,
subtickcolor=blue,tickwidth=1pt,ysubticks=5,xsubticks=9](3,1)
\endpspicture
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection{\nxLkeyword{xylogBase}, \nxLkeyword{xlogBase} and \nxLkeyword{ylogBase}}\label{xylogbase}
%--------------------------------------------------------------------------------------
There are additional options \Lkeyword{xylogBase}, \Lkeyword{xlogBase},
\Lkeyword{ylogBase} to get one or both axes with \Index{logarithmic label}s. For an
interval of [$10^{-3} ... 10^2$] choose a \PST interval
of [-3,2]. \PST takes $0$ as the origin of this axes,
which is wrong if we want to have a logarithmic axes. With the
options \Lkeyword{Oy} and \Lkeyword{Ox} we can set the origin to $-3$, so
that the first label gets $10^{-3}$. If this is not done by the
user then \LPack{pst-plot} does it by default. An alternative
is to set these parameters to empty values \verb|Ox={},Oy={}|, in
this case the package does nothing.
%------------------------------------------------------------------------------------
\subsection{\nxLkeyword{xylogBase}}\label{logbase}
%------------------------------------------------------------------------------------
This mode in math is also called double logarithmic. It is a
combination of the two foregoing modes and the function is now
$y=\log x$ and is shown in the following example.
\psset{xyAxes=true}
\medskip
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psplot[linewidth=2pt,linecolor=red]{0.001}{3}{x log}
\psaxes[xylogBase=10,Oy=-3,Ox=-3]{->}(-3,-3)(3.5,3.5)
\uput[-90](3.5,-3){x}
\uput[180](-3,3.5){y}
\rput(2.5,1){$y=\log x$}
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------------
\subsection{\nxLkeyword{ylogBase}}\label{ylogbase}
%--------------------------------------------------------------------------------------------
The values for the \Lcs{psaxes} y-coordinate are now the
exponents to the base $10$ and for the right function to the base
$e$: $10^{-3} \ldots 10^1$ which corresponds to the given
y-interval $-3\ldots 1.5$, where only integers as exponents are
possible. These logarithmic labels have no effect on the
internally used units. To draw the logarithm function we have to
use the math function
\[y=\log\{\log x\}\]
\[y=\ln\{\ln x\}\]
with an drawing interval of $1.001\ldots 6$.
\medskip
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-0.5,-3.5)(6.5,1.5)
\psaxes[ylogBase=10,Oy=-3]{->}(0,-3)(6.5,1.5)
\uput[-90](6.5,-3){x}
\uput[0](0,1.4){y}
\rput(5,1){$y=\log x$}
\psplot[linewidth=2pt,%
plotpoints=100,linecolor=red]{1.001}{6}{x log log} % log(log(x))
\end{pspicture}
\end{LTXexample}
\medskip
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-0.5,-3.5)(6.5,1.5)
\psplot[linewidth=2pt,plotpoints=100,linecolor=red]%
{1.04}{6}[ /ln {log 0.4343 div} def ]{x ln ln} % log(x)
\psaxes[ylogBase=e,Oy=-3]{->}(0,-3)(6.5,1.5)
\uput[-90](6.5,-3){x}
\uput[0](0,1.5){y}
\rput(5,1){$y=\ln x$}
\end{pspicture}
\end{LTXexample}
\medskip
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-0.5,1.75)(6.5,4.5)
\psaxes[ylogBase=10,Oy=2]{->}(0,2)(0,2)(6.5,4.5)
\end{pspicture}
\end{LTXexample}
\medskip
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-0.5,-0.25)(6.5,4.5)
\psplot{0}{6}{x x cos add log} % x + cox(x)
\psplot[linecolor=red]{0}{6}{x 3 exp x cos add log} % x^3 + cos(x)
\psplot[linecolor=cyan]{0}{6}{x 5 exp x cos add log} % x^5 + cos(x)
\psaxes[ylogBase=10]{->}(6.5,4.5)
\end{pspicture}
\end{LTXexample}
\medskip
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-0.5,-1.25)(6.5,4.5)
\psplot{0}{6}{x x cos add log} % x + cox(x)
\psplot[linecolor=red]{0}{6}{x 3 exp x cos add log} % x^3 + cos(x)
\psplot[linecolor=cyan]{0}{6}{x 5 exp x cos add log} % x^5 + cos(x)
\psaxes[ylogBase=10]{->}(0,-1)(0,-1)(6.5,4.5)
\end{pspicture}
\end{LTXexample}
\medskip
\begin{LTXexample}[width=4cm]
\begin{pspicture}(2.5,1.75)(6.5,4.5)
\psplot[linecolor=cyan]{3}{6}{x 5 exp x cos add log} % x^5 + cos(x)
\psaxes[ylogBase=10,Ox=3,Oy=2]{->}(3,2)(3,2)(6.5,4.5)
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection{\nxLkeyword{xlogBase}}\label{xlogbase}
%--------------------------------------------------------------------------------------
Now we have to use the easy math function $y=x$ because the x axis is still $\log x$.
\xLkeyword{xlogBase}
\medskip
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psplot[linewidth=2pt,linecolor=red]{-3}{3}{x} % log(x)
\psplot[linewidth=2pt,linecolor=blue]{-1.3}{1.5}{x 0.4343 div} % ln(x)
\psaxes[xlogBase=10,Oy=-3,Ox=-3]{->}(-3,-3)(3.5,3.5)
\uput[-90](3.5,-3){x}
\uput[180](-3,3.5){y}
\rput(2.5,1){$y=\log x$}
\rput[lb](0,-1){$y=\ln x$}
\end{pspicture}
\end{LTXexample}
\begin{center}
\psset{yunit=3cm,xunit=2cm}
\begin{pspicture}(-1.25,-1.25)(4.25,1.5)
\uput[-90](4.25,-1){x}
\uput[0](-1,1.25){y}
\rput(0,1){$y=\sin x$}
\psplot[linewidth=2pt,plotpoints=5000,linecolor=red]{-1}{3.5}{10 x exp sin }
\psaxes[xlogBase=10,Oy=-1,Ox=-1]{->}(-1,-1)(4.25,1.25)
\psline[linestyle=dashed](!0 1)(!90 log 1)(!90 log 0)
\end{pspicture}
\end{center}
\begin{lstlisting}
\psset{yunit=3cm,xunit=2cm}
\begin{pspicture}(-1.25,-1.25)(4.25,1.5)
\uput[-90](4.25,-1){x}
\uput[0](-1,1.25){y}
\rput(0,1){$y=\sin x$}
\psplot[linewidth=2pt,plotpoints=5000,linecolor=red]{-1}{3.5}{10 x exp sin }
\psaxes[xlogBase=10,Ox=-1,Oy=-1]{->}(-1,-1)(4.25,1.25)
\psline[linestyle=dashed](-1,0)(4,0)
\psline[linestyle=dashed](!-1 1)(!90 log 1)(!90 log -1)
\psline[linestyle=dashed](!90 log 1)(!180 log 1)(!180 log -1)
\end{pspicture}
\end{lstlisting}
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-3.5,-2.5)(3.5,2.5)
\psaxes[xlogBase=10]{->}(0,0)(-3.5,-2.5)(3.5,2.5)
\psplot{-2.5}{2.5}{10 x exp log}
\end{pspicture}
\end{LTXexample}
\medskip
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-3.5,-2.5)(3.5,2.5)
\psaxes[xlogBase=10,Ox={},Oy={}]{->}(0,0)(-3.5,-2.5)(3.5,2.5)
\psplot{-2.5}{2.5}{10 x exp log}
\end{pspicture}
\end{LTXexample}
%------------------------------------------------------------------------------------
\subsection{No logstyle (\nxLkeyword{xylogBase=\{\}})}
%------------------------------------------------------------------------------------
This is only a demonstration that the default option \xLkeyword{xylogBase}=\{\} still works ... :-)
\medskip
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-3.5,-0.5)(3.5,2.5)
\psplot[linewidth=2pt,linecolor=red,xylogBase={}]{0.5}{3}{x log} % log(x)
\psaxes{->}(0,0)(-3.5,0)(3.5,2.5)
\uput[-90](3.5,0){x}
\uput[180](0,2.5){y}
\rput(2.5,1){$y=\log x$}
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection{Option \nxLkeyword{tickwidth} and \nxLkeyword{subtickwidth}}\label{tickwidth}
%--------------------------------------------------------------------------------------
\begin{center}
{\psset{arrowscale=3,arrows=-D>,yAxis=false}
\psaxes[subticks=8](0,0)(-5,-1)(5,1)\\[1cm]
\psaxes[subticks=4,ticksize=-4pt 0,xlabelPos=top](0,0)(5,1)(-5,-1)\\
\psaxes[subticks=4,ticksize=-10pt 0](0,0)(-5,-5)(5,5)\\[1cm]
\psaxes[subticks=10,ticksize=0 -10pt](0,0)(-5,-5)(5,5)\\[1cm]
\psaxes[subticks=4,ticksize=0 10pt,xlabelPos=bottom](0,0)(5,5)(-5,-5)\\[1cm]
\psaxes[subticks=4,ticksize=0 -10pt,xlabelPos=top](0,0)(5,5)(-5,-5)\\[0.25cm]
\psaxes[subticks=0](0,0)(-5,-5)(5,5)\\[1cm]
\psaxes[subticks=0,tickcolor=red,linecolor=blue,xlabelPos=top](0,0)(5,5)(-5,-5)\\
\psaxes[subticks=5,tickwidth=2pt,subtickwidth=1pt](0,0)(-5,-5)(5,5)\\[1cm]
\psaxes[subticks=0,tickcolor=red,xlabelPos=top](0,0)(5,5)(-5,-5)}
\end{center}
\begin{lstlisting}[xrightmargin=-1.75cm]
\psset{arrowscale=3,arrows=-D>,yAxis=false}
\psaxes[subticks=8](0,0)(-5,-1)(5,1)\\[1cm]
\psaxes[subticks=4,ticksize=-4pt 0,xlabelPos=top](0,0)(5,1)(-5,-1)\\
\psaxes[subticks=4,ticksize=-10pt 0](0,0)(-5,-5)(5,5)\\[1cm]
\psaxes[subticks=10,ticksize=0 -10pt](0,0)(-5,-5)(5,5)\\[1cm]
\psaxes[subticks=4,ticksize=0 10pt,xlabelPos=bottom](0,0)(5,5)(-5,-5)\\[1cm]
\psaxes[subticks=4,ticksize=0 -10pt,xlabelPos=top](0,0)(5,5)(-5,-5)\\[0.25cm]
\psaxes[subticks=0](0,0)(-5,-5)(5,5)\\[1cm]
\psaxes[subticks=0,tickcolor=red,linecolor=blue,xlabelPos=top](0,0)(5,5)(-5,-5)\\
\psaxes[subticks=5,tickwidth=2pt,subtickwidth=1pt](0,0)(-5,-5)(5,5)\\[1cm]
\psaxes[subticks=0,tickcolor=red,xlabelPos=top](0,0)(5,5)(-5,-5)}
\end{lstlisting}
\clearpage
\vspace*{4cm}
\begin{center}
\psset{arrowscale=3,xAxis=false}
\psaxes[subticks=8]{->}(0,0)(-5,-5)(5,5)\hspace{2em}
\psaxes[subticks=4,ylabelPos=right,ylabelPos=left]{->}(0,0)(5,5)(-5,-5)\hspace{4em}
\psaxes[subticks=4,ticksize=0 4pt]{->}(0,0)(-5,-5)(5,5)\hspace{3em}
\psaxes[subticks=4,ticksize=-4pt 0]{->}(0,0)(-5,-5)(5,5)\hspace{1em}
\psaxes[subticks=4,ticksize=0 4pt,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{3em}
\psaxes[subticks=4,ticksize=-4pt 0,linecolor=red,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{5em}
\psaxes[subticks=0]{->}(0,0)(-5,-5)(5,5)\hspace{1em}
\psaxes[subticks=0,tickcolor=red,linecolor=blue,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{5em}
\psaxes[subticks=5,tickwidth=2pt,subtickwidth=1pt]{->}(0,0)(-5,-5)(5,5)\hspace{1em}
\psaxes[subticks=5,tickcolor=red,tickwidth=2pt,%
ticksize=10pt,subtickcolor=blue,subticksize=0.75,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)
\end{center}
\vspace*{5cm}
\begin{lstlisting}[xrightmargin=-1.75cm]
\psset{arrowscale=3,xAxis=false}
\psaxes[subticks=8]{->}(0,0)(-5,-5)(5,5)\hspace{2em}
\psaxes[subticks=4,ylabelPos=right,ylabelPos=left]{->}(0,0)(5,5)(-5,-5)\hspace{4em}
\psaxes[subticks=4,ticksize=0 4pt]{->}(0,0)(-5,-5)(5,5)\hspace{3em}
\psaxes[subticks=4,ticksize=-4pt 0]{->}(0,0)(-5,-5)(5,5)\hspace{1em}
\psaxes[subticks=4,ticksize=0 4pt,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{3em}
\psaxes[subticks=4,ticksize=-4pt 0,linecolor=red,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{5em}
\psaxes[subticks=0]{->}(0,0)(-5,-5)(5,5)\hspace{1em}
\psaxes[subticks=0,tickcolor=red,linecolor=blue,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{5em}
\psaxes[subticks=5,tickwidth=2pt,subtickwidth=1pt]{->}(0,0)(-5,-5)(5,5)\hspace{1em}
\psaxes[subticks=5,tickcolor=red,tickwidth=2pt,%
ticksize=10pt,subtickcolor=blue,subticksize=0.75,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)
\end{lstlisting}
\psset{xyAxes=true}
\begin{LTXexample}[width=5.5cm]
\pspicture(5,5.5)
\psaxes[subticks=4,ticksize=6pt,subticksize=0.5,%
tickcolor=red,subtickcolor=blue]{->}(5.4,5)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[width=5.5cm]
\pspicture(5,5.5)
\psaxes[subticks=5,ticksize=0 6pt,subticksize=0.5]{->}(5.4,5)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[width=5.5cm]
\pspicture(5,5.5)
\psaxes[subticks=5,ticksize=-6pt 0,subticksize=0.5]{->}(5.4,5)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[width=6.5cm]
\pspicture(-3,-3)(3,3.5)
\psaxes[subticks=5,ticksize=0 6pt,subticksize=0.5]{->}(0,0)(3,3)(-3,-3)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[width=6.5cm]
\pspicture(0,0.5)(-3,-3)
\psaxes[subticks=5,ticksize=-6pt 0,subticksize=0.5,linecolor=red]{->}(-3,-3)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[width=5.5cm]
\psset{axesstyle=frame}
\pspicture(5,5.5)
\psaxes[subticks=4,tickcolor=red,subtickcolor=blue](5,5)
\endpspicture
\end{LTXexample}
\vspace{1cm}
\begin{LTXexample}[width=5.5cm]
\pspicture(5,5.5)
\psaxes[subticks=5,subticksize=1,subtickcolor=lightgray](5,5)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[width=5.5cm]
\pspicture(5,5.5)
\psaxes[subticks=2,subticksize=1,subtickcolor=lightgray](5,5)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\pspicture(3,4.5)
\psaxes[subticks=5,ticksize=-7pt 0](3,4)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\pspicture(0,1)(-3,-4)
\psaxes[subticks=5](-3,-4)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\pspicture(3,4.5)
\psaxes[axesstyle=axes,subticks=5](3,4)
\endpspicture
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\pspicture(0,1)(-3,-4)
\psaxes[axesstyle=axes,subticks=5,%
ticksize=0 10pt](-3,-4)
\endpspicture
\end{LTXexample}
\subsection{Option \nxLkeyword{psgrid}, \nxLkeyword{gridcoor}, and \nxLkeyword{gridpara}}\label{psgrid}
A simple grid can be set with the optional argument \Lkeyword{psgrid} which uses
the setting of \Lkeyword{gridpara} and \Lkeyword{gridcoor}.
\Lkeyword{gridpara} is preset to
\begin{lstlisting}
\gridpara={gridlabels=0pt,gridcolor=red!30,subgridcolor=green!30,
subgridwidth=0.5\pslinewidth,subgriddiv=5},...
\end{lstlisting}
\begin{LTXexample}[pos=t]
\usepackage{pst-plot}
\psset{llx=-5mm,lly=-5mm,urx=5mm,ury=5mm,labelFontSize=\scriptstyle,
algebraic,plotpoints=200,psgrid,gridcoor={(0,0)(9,4)}}
\begin{psgraph}[linecolor=gray]{->}(0,0)(9,4){10cm}{!}
\psplot[linecolor=NavyBlue]{0}{9}{sqrt(x)}% needs dvipsnames
\psdots(*2 {sqrt(2)})(4,2)(4,0)
\uput[90](*2 {sqrt(2)}){$(x,y)$}\uput[90](4,2){$(4,2)$}\uput[90](4,0){$(4,0)$}
\rput(7,2.2){\textcolor{NavyBlue}{$y=\sqrt{x}$}}
\end{psgraph}
\end{LTXexample}
%$
%------------------------------------------------------------------------------------
\section{New options for \nxLcs{readdata}}\label{ignorelines}
%------------------------------------------------------------------------------------
By default the macro \Lcs{readdata} reads every data record,
which could be annoying when you have some text lines at top of
your data files or when there are more than 10000 records to read.
\LPack{pst-plot} defines two additional keys \Lkeyword{ignoreLines}
and \Lkeyword{nStep}, which allows you to ignore preceeding lines, e.\,g.
\Lkeyword{ignoreLines}=2, or to read only a selected part of the data
records, e.\,g. \Lkeyword{nStep}=10, only every 10\textsuperscript{th}
record is saved.
\begin{lstlisting}
\readdata[ignoreLines=2]{\dataA}{data/stressrawdata.data}
\readdata[nStep=10]{\dataA}{data/stressrawdata.data}
\end{lstlisting}
The default value for \Lkeyword{ignoreLines} is $0$ and for \Lkeyword{nStep} is $1$.
the following data file has two text lines which shall be ignored by the \Lcs{readdata} macro:
\begin{LTXexample}[width=4cm]
\begin{filecontents*}{data/pstricks-add-data9.data}
some nonsense in this line ---time forcex forcey
0 0.2
1 1
2 4
\end{filecontents*}
\readdata[ignoreLines=2]{\data}{data/pstricks-add-data9.data}
\pspicture(2,4)
\listplot[showpoints]{\data}
\psaxes{->}(2,4)
\endpspicture
\end{LTXexample}
%--------------------------------------------------------------------------------------
\section{New options for \nxLcs{listplot}}
%--------------------------------------------------------------------------------------
By default the plot macros \Lcs{dataplot}, \Lcs{fileplot} and \Lcs{listplot} plot every
data record. There are noew additional keys
\Lkeyword{nStep}, \Lkeyword{nStart}, \Lkeyword{nEnd}, and \Lkeyword{xStep}, \Lkeyword{xStart},
\Lkeyword{xEnd}, which allows
to plot only a selected part of the data records, e.\,g. \Lkeyword{nStep}=10. These "`n"'
options mark the number of the record to be plotted ($0,1,2,...$) and the "`x"' ones the x-values of the data records.
The new options are only available
for the \Lcs{listplot} macro, which is not a real limitation, because all data records can be read
from a file with the \Lcs{readdata} macro (see example files or~\cite{dtk02.2:jackson.voss:plot-funktionen}):
\begin{lstlisting}[style=syntax]
\readdata[nStep=10]{\data}{data/data1.data}
\end{lstlisting}
\xLcs{readdata}
The use \Lkeyword{nStep} and \Lkeyword{xStep} options only make real sense
when also using the option \Lkeyset{plotstyle=dots}. Otherwise the
coordinates are connected by a line as usual. Also the
\Lkeyword{xStep} option needs increasing x values. Note that
\Lkeyword{nStep} can be used for \Lcs{readdata} and for
\Lcs{listplot}. If used in both macros then the effect is
multiplied, e.g. \Lcs{readdata} with \Lkeyword{nStep}=5 and
\Lcs{listplot} with \Lkeyword{nStep}=10 means, that only every
50\textsuperscript{th} data record is read and plotted.
When both, \verb|x/yStart/End| are defined then the values are also compared with
both values.
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{nStep}, \nxLkeyword{xStep}, and \nxLkeyword{yStep}}\label{nxstep}
%--------------------------------------------------------------------------------------
The datafile \verb|data.data| contains $1000$ data records. The thin blue line is the plot
of all records with the plotstyle option \Lkeyval{curve}.\xLkeyword{nStep}\xLkeyword{xStep}\xLkeyword{yStep}
\begin{LTXexample}[preset=\centering,pos=t]
\readdata{\data}{data/data.data}
\psset{xunit=12.5cm,yunit=0.2mm}
\begin{pspicture}(-0.080,-30)(1,270)
\pstScalePoints(1,1){1000 div}{1000 div}
\psaxes[Dx=200,dx=2.5cm,Dy=100,ticksize=0 5pt,tickstyle=inner,
subticks=10,ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250)
\listplot[nStep=50,linewidth=3pt,linecolor=red,plotstyle=dots]{\data}
\listplot[linewidth=1pt,linecolor=blue]{\data}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[preset=\centering,pos=t]
\readdata{\data}{data/data.data}
\psset{xunit=12.5cm,yunit=0.2mm}
\begin{pspicture}(-0.080,-30)(1,270)
\pstScalePoints(1,1){1000 div}{1000 div}
\psaxes[Dx=200,dx=2.5cm,Dy=100,ticksize=0 5pt,tickstyle=inner,
subticks=10,ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250)
\listplot[xStep=100,linewidth=2pt,linecolor=red,plotstyle=dots]{\data}
\multido{\rA=0.1+0.1}{9}{%
\psline[linecolor=black!40,linestyle=dashed](\rA,0)(\rA,250)}
\listplot[yStep=50000,linewidth=2pt,linecolor=blue,plotstyle=dots]{\data}
\multido{\nA=50+50}{5}{%
\psline[linecolor=black!40,linestyle=dashed](0,\nA)(1,\nA)}
\listplot[linewidth=0.5pt]{\data}
\end{pspicture}
\end{LTXexample}
\clearpage
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{nStart} and \nxLkeyword{xStart}}\label{nxstart}
%--------------------------------------------------------------------------------------
\begin{LTXexample}[preset=\centering,pos=t]
\readdata{\data}{data/data.data}
\psset{xunit=12.5cm,yunit=0.2mm}
\begin{pspicture}(-0.080,-30)(1,270)
\pstScalePoints(1,1){1000 div}{1000 div}
\psaxes[Dx=200,dx=2.5cm,Dy=100,ticksize=0 5pt,tickstyle=inner,
subticks=10,ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250)
\listplot[nStart=200,linewidth=3pt,
linecolor=blue,plotstyle=dots]{\data}
\listplot[linewidth=1pt,linecolor=blue]{\data}
\end{pspicture}
\end{LTXexample}
\clearpage
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{nEnd} and \nxLkeyword{xEnd}}\label{nxend}
%--------------------------------------------------------------------------------------
\begin{LTXexample}[preset=\centering,pos=t]
\readdata{\data}{data/data.data}
\psset{xunit=12.5cm,yunit=0.2mm}
\begin{pspicture}(-0.080,-30)(1,270)
\pstScalePoints(1,1){1000 div}{1000 div}
\psaxes[axesstyle=frame,Dx=200,dx=2.5cm,Dy=100,ticksize=0 5pt,tickstyle=inner,
subticks=10,ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250)
\listplot[nStart=200,linewidth=3pt,
linecolor=blue]{\data}
\listplot[linewidth=1pt,linecolor=blue]{\data}
\end{pspicture}
\end{LTXexample}
\clearpage
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{yStart} and \nxLkeyword{yEnd}}\label{ystartend}
%--------------------------------------------------------------------------------------
\begin{LTXexample}[preset=\centering,pos=t]
\readdata{\data}{data/data.data}
\psset{xunit=12.5cm,yunit=0.2mm}
\begin{pspicture}(-0.080,-30)(1,270)
\pstScalePoints(1,1){1000 div}{1000 div}
\psaxes[axesstyle=frame,Dx=200,dx=2.5cm,Dy=100,ticksize=0 5pt,tickstyle=inner,
ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250)
\psset{linewidth=0.1pt, linestyle=dashed,linecolor=red}
\psline(0,40)(1,40)
\psline(0,175)(1,175)
\listplot[yStart=40000, yEnd=175000,linewidth=3pt,linecolor=blue,plotstyle=dots]{\data}
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\subsection{Options \nxLkeyword{plotNo}, \nxLkeyword{plotNoX}, and \nxLkeyword{plotNoMax}}\label{plotno}
%--------------------------------------------------------------------------------------
By default the plot macros expect \verb+x|y+ data records, but
when having data files with multiple values for y, like:
\begin{lstlisting}[style=syntax]
x y1 y2 y3 y4 ... yMax
x y1 y2 y3 y4 ... yMax
...
\end{lstlisting}
you can select the y value which should be plotted. The option \Lkeyword{plotNo} marks the plotted
value (default $1$) and the option \Lkeyword{plotNoMax} tells \LPack{pst-plot} how many $y$ values are
present. There are no real restrictions in the maximum number for \Lkeyword{plotNoMax}.
We have the following data file:
\begin{lstlisting}[style=syntax]
[% file data.data
0 0 3.375 0.0625
10 5.375 7.1875 4.5
20 7.1875 8.375 6.25
30 5.75 7.75 6.6875
40 2.1875 5.75 5.9375
50 -1.9375 2.1875 4.3125
60 -5.125 -1.8125 0.875
70 -6.4375 -5.3125 -2.6875
80 -4.875 -7.1875 -4.875
90 0 -7.625 -5.625
100 5.5 -6.3125 -5.8125
110 6.8125 -2.75 -4.75
120 5.25 2.875 -0.75
]%
\end{lstlisting}
\noindent which holds data records for multiple plots (\verb+x y1 y2 y3+). This can be plotted
without any modification to the data file:
\begin{LTXexample}[preset=\centering,pos=t]
\readdata\Data{data/dataMul.data}
\psset{xunit=0.1cm, yunit=0.5cm,lly=-0.5cm}
\begin{pspicture}(0,-7.5)(150,10)
\psaxes[Dx=10,Dy=2.5]{->}(0,0)(0,-7.5)(150,7.5)[$\mathbf{x}$,-90][$\mathbf{y}$,0]
\psset{linewidth=2pt,plotstyle=curve}
\listplot[linecolor=green,plotNo=1,plotNoMax=3]{\Data}
\listplot[linecolor=red,plotNo=2,plotNoMax=3]{\Data}
\listplot[linecolor=blue,plotNo=3,plotNoMax=3]{\Data}
\end{pspicture}
\end{LTXexample}
It is also possible to select another column for the $x$-value. Suppose we have
a data base with records like \verb+x y y x y+, then it is by default a record
with one $x$ value and four possible $y$ values. We still have to define
\Lkeyword{plotNoMax}=4. However, it is possible to select the forth value as
new $x$ value by setting \Lkeyword{plotNoX=4} (it is preset to 1).
Then the forth value is taken as $x$. The example uses the the following
data set.
\begin{lstlisting}[style=syntax]
% X1 X2 Y1 Y2
2 55.1500 10.35 11.26
31 59.7167 11.06 11.11
34 65.7167 11.87 10.83
40 62.1833 11.59 11.19
45 56.0500 10.74 11.50
47 68.2667 12.65 11.11
52 69.7500 13.23 11.38
55 76.3333 14.28 11.22
59 75.4000 14.69 11.69
62 78.6000 15.25 11.64
66 69.3167 14.06 12.17
69 77.5500 15.24 11.79
73 70.8833 14.52 12.29
75 60.6167 13.10 12.97
79 68.3833 14.43 12.66
82 56.6833 12.05 12.75
87 95.1333 21.10 13.31
\end{lstlisting}
\begin{LTXexample}[pos=t,preset=\centering]
\readdata{\data}{data/demo.txt}
\psset{xAxisLabel={},yAxisLabel={},llx=-5mm}
\begin{psgraph}[axesstyle=frame,Dy=5,Dx=10,ticksize=5pt 0](0,0)(100,25){10cm}{8cm}
\psset{dotstyle=square,dotscale=1.5,linewidth=1.5pt}
\listplot[plotNoMax=3,plotNo=2,linecolor=red,plotstyle=dots]{\data}
\listplot[plotNoMax=3,plotNoX=2,plotNo=3,linecolor=blue,plotstyle=dots]{\data}
\end{psgraph}
\end{LTXexample}
\clearpage
%--------------------------------------------------------------------------------------
\subsection{Option \nxLkeyword{changeOrder}}\label{changeorder}
%--------------------------------------------------------------------------------------
It is only possible to fill the region between two listplots with
\Lcs{pscustom} if one of them has the values in reverse order.
Otherwise we do not get a closed path. With the option
\Lkeyword{ChangeOrder} the values are used in reverse order:
\begin{LTXexample}[pos=t,preset=\centering]
\begin{filecontents*}{data/test.data}
0 3 8
2 4 7
5 5 5.5
7 3.5 5
10 2 9
\end{filecontents*}
\psset{lly=-.5cm}
\begin{psgraph}[axesstyle=frame,ticklinestyle=dotted,ticksize=0 10](0,0)(10,10){4in}{2in}%
\readdata{\data}{data/test.data}%
\pscustom[fillstyle=solid,fillcolor=blue!40]{%
\listplot[plotNo=2,plotNoMax=2]{\data}%
\listplot[plotNo=1,plotNoMax=2,ChangeOrder]{\data}}
\end{psgraph}
\end{LTXexample}
\clearpage
\section{New plot styles}
%--------------------------------------------------------------------------------------
\subsection{Plot style \nxLkeyword{colordot} and option \nxLkeyword{Hue}}\label{colordot}
%--------------------------------------------------------------------------------------
The plotted dots can be colored with the \Index{HSB} color model, where \Index{Hue}
is set by an angle (0\ldots360) and the values of \Index{Saturation} and \Index{Brightnes}
are set by the relative $y$ value of the data records. The default value for
\Lkeyword{Hue} is 180.
\readdata{\data}{data/data3.data}
\psset{xunit=10,yunit=0.02}
\begin{pspicture}(0,-50)(1.1,400)
\psaxes[dy=1cm,Dy=50]{->}(0,0)(0,-50)(1.1,400)
\listplot[Hue=280,plotstyle=colordots]{\data}
\end{pspicture}
\psset{unit=1cm}
\begin{lstlisting}
\readdata{\data}{data/data3.data}
\psset{xunit=10,yunit=0.02}
\begin{pspicture}(0,-50)(1.1,400)
\psaxes[dy=1cm,Dy=50]{->}(0,0)(0,-50)(1.1,400)
\listplot[?\ON?Hue=280?\OFF?,plotstyle=?\ON?colordots?\OFF?]{\data}
\end{pspicture}
\end{lstlisting}
\clearpage
%--------------------------------------------------------------------------------------
\subsection{Plot style \nxLkeyword{bar} and option \nxLkeyword{barwidth}}\label{barwidth}
%--------------------------------------------------------------------------------------
This option allows you to draw bars for the data records. The
width of the bars is controlled by the option \Lkeyword{barwidth},
which is set by default to value of \verb+0.25cm+, which is the
total width.
\def\barData{
0 0.03
1 0.11
2 0.28
3 0.84
4 6.70
5 8.55
6 8.77
7 11.09
8 7.18
9 6.20
10 5.78
11 4.19
12 2.37
13 2.26
14 1.68
15 1.03
16 1.37
17 1.34
18 0.92
19 0.67
20 0.87
21 1.20
22 1.98
23 3.99
24 5.08
25 5.17
26 5.78
27 4.44
28 0.11
}
\begin{LTXexample}[preset=\centering,pos=t]
\psset{xunit=.44cm,yunit=.3cm}
\begin{pspicture}(-2,-3)(29,13)
\psaxes[axesstyle=axes,Ox=1466,Oy=0,Dx=4,Dy=2,xticksize=-6pt 0,
ylabelFactor={\,\%}]{-}(29,12)
\listplot[shadow=true,linecolor=blue,plotstyle=bar,barwidth=0.3cm,
fillcolor=red,fillstyle=solid]{\barData}
\rput{90}(-3,6.25){Amount}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[preset=\centering,pos=t]
\psset{xunit=.44cm,yunit=.3cm}
\begin{pspicture}(-2,-3)(29,13)
\psaxes[axesstyle=axes,Ox=1466,Oy=0,Dx=4,Dy=2,ticksize=-4pt 0,
ylabelFactor={\,\%}]{-}(29,12)
\listplot[linecolor=blue,plotstyle=bar,barwidth=0.3cm,
fillcolor=red,fillstyle=crosshatch]{\barData}
\rput{90}(-3,6.25){Amount}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[preset=\centering,pos=t]
\psset{xunit=.44cm,yunit=.3cm}
\begin{pspicture}(-2,-3)(29,13)
\psaxes[axesstyle=axes,Ox=1466,Oy=0,Dx=4,Dy=2,ticksize=-4pt 0,
ylabelFactor={\,\%}]{-}(29,12)
\listplot[linecolor=blue,plotstyle=bar,barwidth=0.3cm,
fillcolor=red,fillstyle=vlines]{\barData}
\listplot[showpoints=true]{\barData}
\rput{90}(-3,6.25){Amount}
\end{pspicture}
\end{LTXexample}
\subsubsection{Interrupted bar plot}
The new keywords \Lkeyword{interrupt} takes three comma separated values:
the value, when the interrupted $y$ axis is interruptes, the separation for the
drawn tilde and the value for the inrrupted section, e.g. \verb|interrupt={15,1,30}|.
\psset{xunit=.44cm,yunit=.3cm}
\begin{pspicture}(-2,-3)(29,32)
\psaxes[axesstyle=axes,ticksize=-4pt 0,Dy=2,Dx=2](29,15)
\rput(0,15.4){\textbf{\huge$\approx$}}
\rput(0,16){\psaxes[xAxis=false,ticksize=-4pt 0,
Dy=2,Oy=46,Dx=2](29,15)}
\psset{interrupt={15,1,30}}
\listplot[linecolor=red,plotstyle=bar,barwidth=0.3cm,
fillcolor=red!30,fillstyle=solid]{
0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 10 2
11 1 12 50 13 55 14 14 15 7 16 9 17 7 18 4
19 2 20 3 21 0 22 0 23 0 24 1 25 2 % 1st example
}
\listplot[linecolor=blue,plotstyle=bar,barwidth=0.3cm,
fillcolor=blue!30,fillstyle=solid,opacity=0.5]{
0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 3 10 10
11 11 12 8 13 61 14 10 15 13 16 3 17 1 18 0
19 0 20 2 21 0 22 0 23 0 24 0 25 0 % 2nd exa
}
\listplot[linecolor=green,plotstyle=bar,barwidth=0.3cm,
fillcolor=green!30,fillstyle=solid,opacity=0.5]{
0 0 1 0 2 0 3 0 4 1 5 0 6 0 7 0 8 0 9 3 10 4
11 11 12 59 13 11 14 12 15 7 16 3 17 1 18 0
19 0 20 2 21 0 22 1 23 0 24 0 25 0 % 3rd exa
}
\end{pspicture}
\begin{lstlisting}
\psset{xunit=.44cm,yunit=.3cm}
\begin{pspicture}(-2,-3)(29,32)
\psaxes[axesstyle=axes,ticksize=-4pt 0,Dy=2,Dx=2](29,15)
\rput(0,15.4){\textbf{\huge$\approx$}}
\rput(0,16){\psaxes[xAxis=false,ticksize=-4pt 0,
Dy=2,Oy=46,Dx=2](29,15)}
\psset{interrupt={15,1,30}}
\listplot[linecolor=red,plotstyle=bar,barwidth=0.3cm,
fillcolor=red!30,fillstyle=solid]{
0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 10 2
11 1 12 50 13 55 14 14 15 7 16 9 17 7 18 4
19 2 20 3 21 0 22 0 23 0 24 1 25 2 % 1st example
}
\listplot[linecolor=blue,plotstyle=bar,barwidth=0.3cm,
fillcolor=blue!30,fillstyle=solid,opacity=0.5]{
0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 3 10 10
11 11 12 8 13 61 14 10 15 13 16 3 17 1 18 0
19 0 20 2 21 0 22 0 23 0 24 0 25 0 % 2nd exa
}
\listplot[linecolor=green,plotstyle=bar,barwidth=0.3cm,
fillcolor=green!30,fillstyle=solid,opacity=0.5]{
0 0 1 0 2 0 3 0 4 1 5 0 6 0 7 0 8 0 9 3 10 4
11 11 12 59 13 11 14 12 15 7 16 3 17 1 18 0
19 0 20 2 21 0 22 1 23 0 24 0 25 0 % 3rd exa
}
\end{pspicture}
\end{lstlisting}
\psset{unit=1cm}
%--------------------------------------------------------------------------------------
\subsection{Plot style \nxLkeyword{ybar}}\label{options:ybar}
%--------------------------------------------------------------------------------------
With the setting \Lkeyset{plotstyle=ybar} the graph is set with horizontal bars instead
of vertical. For \Lkeyword{yLabels} see section~\ref{yLabels}.
\begin{center}
\savedata{\data}[1 1 1 2 1 3 2 4 3 5 4 6 4 7 6 8 6 9 7 10 25 11 30 12 32 13]
\psset{llx=-1.5cm,lly=-1.5cm,xAxisLabel=\textbf{Frequency of Winning the Final},
xAxisLabelPos={c,-1cm},yAxisLabel=,yLabels={,Kerry,Laois,London,Waterford,Clare,Offaly,
Galway,Wexford,Dublin,Limerick,Tipperary,Cork,Kilkenny}}
\begin{psgraph}[axesstyle=frame,labels=x,ticksize=-4pt 0,Dx=5](0,0)(35,14){10cm}{7cm}
\listplot[plotstyle=ybar,fillcolor=blue!20,linecolor=blue,barwidth=4mm,fillstyle=solid]{\data}
\listplot[plotstyle=xvalues,labelsep=5pt]{\data}
\end{psgraph}
\end{center}
\begin{lstlisting}
\savedata{\data}[1 1 1 2 1 3 2 4 3 5 4 6 4 7 6 8 6 9 7 10 25 11 30 12 32 13]
\psset{llx=-1.5cm,lly=-1.5cm,xAxisLabel=\textbf{Frequency of Winning the Final},
xAxisLabelPos={c,-1cm},yAxisLabel=,yLabels={,Kerry,Laois,London,Waterford,Clare,Offaly,
Galway,Wexford,Dublin,Limerick,Tipperary,Cork,Kilkenny}}
\begin{psgraph}[axesstyle=frame,labels=x,ticksize=-4pt 0,Dx=5](0,0)(35,14){10cm}{7cm}
\listplot[plotstyle=ybar,fillcolor=blue!20,linecolor=blue,barwidth=4mm,fillstyle=solid]{\data}
\listplot[plotstyle=xvalues,labelsep=5pt]{\data}
\end{psgraph}
\end{lstlisting}
%--------------------------------------------------------------------------------------
\subsection{Plotstyle \nxLkeyval{LSM}}\label{LSM}
%--------------------------------------------------------------------------------------
With the setting \Lkeyset{plotstyle=LSM} (\textbf{L}east \textbf{S}quare \textbf{Method})\index{Least square method}
the data records are not printed in the usual way as dots or a line,
the \Lcs{listplot} macro calculates the values for a line $y=v\cdot x+u$ which fits
best all data records.
\bgroup
\centering
\psset{lly=-.5cm}
\begin{filecontents*}[force]{data/LSM.data}
0 1 1 3 2.8 4 3 2.9 2 5 4 4 5 5.5 6 8.2 8 7
\end{filecontents*}
\readdata{\data}{data/LSM.data}
\begin{psgraph}[arrows=->](0,0)(0,0)(8,8){.5\textwidth}{!}
\listplot[plotstyle=dots]{\data}
\listplot[plotstyle=LSM,linecolor=red]{\data}
\end{psgraph}
\egroup
\begin{lstlisting}
\begin{filecontents*}[force]{data/LSM.data}
0 1 1 3 2.8 4 3 2.9 2 5 4 4 5 5.5 6 8.2 8 7
\end{filecontents*}
\psset{lly=-.5cm}
\readdata{\data}{data/LSM.data}
\begin{psgraph}[arrows=->](0,0)(0,0)(8,8){.5\textwidth}{!}
\listplot[plotstyle=dots]{\data}
\listplot[?\ON?plotstyle?\OFF?=?\ON?LSM?\OFF?,linecolor=red]{\data}
\end{psgraph}
\end{lstlisting}
The macro looks for the lowest and biggest x-value and draws the
line for this interval. It is possible to pass other values to the
macro by setting the \Lkeyword{xStart} and/or \Lkeyword{xEnd} options.
They are preset with an empty value \verb+{}+.
\bgroup
\centering
\readdata{\data}{data/LSM.data}
\psset{lly=-1.75cm}
\begin{psgraph}[arrows=->](0,0)(0,0)(8,8){.5\textwidth}{!}
\listplot[plotstyle=dots]{\data}
\listplot[PstDebug=1,plotstyle=LSM,xStart=-0.5,xEnd=8.5,linecolor=red]{\data}
\end{psgraph}
\egroup
\begin{lstlisting}
\readdata{\data}{data/LSM.data}
\psset{lly=-1.75cm}
\begin{psgraph}[arrows=->](0,0)(0,0)(8,8){.5\textwidth}{!}
\listplot[plotstyle=dots]{\data}
\listplot[?\ON?PstDebug?\OFF?,plotstyle=?\ON?LSM?\OFF?,?\ON?xStart?\OFF?=-0.5,?\ON?xEnd?\OFF?=8.5,linecolor=red]{\data}
\end{psgraph}
\end{lstlisting}
With \Lkeyword{PstDebug} one gets the equation $y=v\cdot x+u$
printed, beginning at the position (0|-50pt). This cannot be
changed, because it is only for some kind of debugging. Pay
attention for the correct \Lkeyword{xStart} and \Lkeyword{xEnd} values,
when you use the \Lcs{pstScalePoints} Macro. In the following
example we use an x-interval from 0 to 3 to plot the values; first
we subtract 0.003 from all x-values and then scale them with
10000. This is not taken into account for the \Lkeyword{xStart} and
\Lkeyword{xEnd} values.
\bgroup
\centering
\readdata{\data}{data/LSM2.data}
\pstScalePoints(10000,1){ 0.003 sub }{}
\psset{lly=-1.75cm}
\psgraph[arrows=->,Ox=0.0030,Dx=0.0001,dx=\psxunit](0,0)(3.2,3){10cm}{5cm}
\listplot[showpoints=true,linewidth=1pt,linecolor=blue]{\data}
\listplot[PstDebug=1,plotstyle=LSM,linewidth=0.1pt,linestyle=dashed,%
xStart=-0.25,xEnd=3.3]{\data}
\endpsgraph
\egroup
\begin{lstlisting}
\begin{filecontents*}{data/LSM2.data}
0.003298697 1.397785583
0.003193358 1.615489564
0.003094538 2.044019006
0.003001651 2.259240127
\end{filecontents*}
\readdata{\data}{data/LSM2.data}
?\ON?\pstScalePoints?\OFF?(10000,1){ 0.003 sub }{}
\psset{lly=-1.75cm}
\psgraph[arrows=->,Ox=0.0030,Dx=0.0001,dx=\psxunit](0,0)(3.2,3){10cm}{5cm}
\listplot[showpoints=true,linewidth=1pt,linecolor=blue]{\data}
\listplot[PstDebug=1,plotstyle=?\ON?LSM?\OFF?,linewidth=0.1pt,linestyle=dashed,%
xStart=-0.25,xEnd=3.3]{\data}
\endpsgraph
\end{lstlisting}
\clearpage
\subsection{Plotstyles \nxLkeyval{values} and \nxLkeyval{values*}}\label{values}
Instead of plotting the curve with the setting \Lkeyset{plotstyle=values}
the $y$-values are printed at the current point.
\medskip
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-3.5,-.5)(3.5,9.5)
\psaxes{->}(0,0)(-3,0)(3,9)
\psplot{-3}{3}{x dup mul }
\psplot[plotstyle=values]{-3}{3}{x dup mul }
\end{pspicture}
\end{LTXexample}
The possible optional arguments are \Lkeyword{PSfont},\Lkeyword{valuewidth},
\Lkeyword{fontscale}, and \Lkeyword{decimals}. The default setting is:
\begin{Xverbatim}{}
\psset[pst-plot]{PSfont=Times-Roman,fontscale=10,valuewidth=10,decimals=-1}
\end{Xverbatim}
The optional argument \Lkeyword{rot} from the base package \LPack{pstricks} is also taken into account.
With the star version \Lkeyset{plotstyle=values*} the box of the printed value isn't transparent,
everything behind this box is not seen.
\medskip
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-3.5,-.5)(3.5,9.5)
\psaxes{->}(0,0)(-3,0)(3,9)
\psplot{-3}{3}{x dup mul }
\psplot[plotstyle=values*]{-3}{3}{x dup mul }
\end{pspicture}
\end{LTXexample}
\subsection{Plotstyles \nxLkeyval{xvalues} and \nxLkeyval{xvalues*}}\label{xvalues}
This is similiar to the options \Lkeyval{values}, except that it plots the $x$-values
instead of the $y$-values. This maybe useful when also using the plotstyle \Lkeyval{ybar}
(see~Section\vref{options:ybar}).
\medskip
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-2.5,-.5)(2.5,5.5)
\psaxes{->}(0,0)(-2,0)(2,5.5)
\psplot{-2}{2}{x dup mul }
\psplot[plotstyle=xvalues,
plotpoints=10]{-2}{2}{x dup mul }
\end{pspicture}
\end{LTXexample}
\clearpage
%--------------------------------------------------------------------------------------
\section{Polar plots}\label{polarplots}
%--------------------------------------------------------------------------------------
With the option \Lkeyword{polarplot}=\false|\true\ it is possible to use any plot command %\Lcs{psplot}
in polar mode:
\begin{BDef}
\Lcs{ps????plot}\OptArg{polarplot,...}\Largb{<start angle>}\Largb{<end angle>}\%\\
\OptArg{PS command}\Largb{<r(alpha)>}
\end{BDef}
The equation in PostScript code is interpreted as a function $r=f(\alpha)$, e.g. for the
circle with radius 1 as $r=\sqrt{\sin^2x+\cos^2x}$, or $r=a*\dfrac{sin(x)*cos(x)}{(sin(x)^3+cos(x)^3)}$
for the following examples:
\begin{lstlisting}[style=syntax]
x sin dup mul x cos dup mul add sqrt
\end{lstlisting}
\medskip
\begin{LTXexample}[pos=t]
\psset{plotpoints=200,unit=0.75}
\begin{pspicture*}(-5,-5)(5.1,5.1)
\psaxes[arrowlength=1.75,ticksize=2pt,labelFontSize=\scriptstyle,
linewidth=0.2mm]{->}(0,0)(-4.99,-4.99)(5,5)[x,-90][y,180]
\rput[Br](-.15,-.35){$0$} \psset{linewidth=.35mm,polarplot}
\psplot[linecolor=red]{140}{310}{3 neg x sin mul x cos mul x sin 3 exp x cos 3 exp add div}
\psplot[linecolor=cyan]{140}{310}{6 x sin mul x cos mul x sin 3 exp x cos 3 exp add div}
\psplot[linecolor=blue,algebraic]{2.44}{5.41}{-8*sin(x)*cos(x)/(sin(x)^3+cos(x)^3)}
\end{pspicture*}
\end{LTXexample}
\medskip
\begin{LTXexample}[pos=t]
\psset{unit=0.5cm}
\begin{pspicture}(-6,-6)(6,6)
\psaxes[axesstyle=polar,labelFontSize=\scriptstyle,linewidth=0.2mm]{->}(6,6)
\psset{linewidth=3pt,polarplot,plotpoints=500,plotstyle=curve}
\psclip{\pscircle[linestyle=none]{6}}
\psplot[linecolor=red]{140}{310}{3 neg x sin mul x cos mul x sin 3 exp x cos 3 exp add div}
\psplot[linecolor=cyan]{140}{310}{6 x sin mul x cos mul x sin 3 exp x cos 3 exp add div}
\psplot[linecolor=blue,algebraic]{2.44}{5.41}{-8*sin(x)*cos(x)/(sin(x)^3+cos(x)^3)}
\endpsclip
\end{pspicture}
\end{LTXexample}
\medskip
\begin{LTXexample}[width=5cm]
\psset{plotpoints=200,unit=1}
\begin{pspicture}(-2.5,-2.5)(2.5,2.5)% Ulrich Dirr
\psaxes[arrowlength=1.75,%
ticksize=2pt,linewidth=0.17mm]{->}%
(0,0)(-2.5,-2.5)(2.5,2.5)[$x$,-90][$y$,180]
\rput[Br](-.15,-.35){$0$}
\psset{linewidth=.35mm,plotstyle=curve,polarplot}
\psplot[linecolor=red]{0}{360}{x cos 2 mul x sin mul}
\psplot[linecolor=green]{0}{360}{x cos 3 mul x sin mul}
\psplot[linecolor=blue]{0}{360}{x cos 4 mul x sin mul}
\end{pspicture}
\end{LTXexample}
\medskip
\begin{LTXexample}[width=8cm]
\psset{plotpoints=200,unit=0.5}
\begin{pspicture}(-8.5,-8.5)(9,9)% Ulrich Dirr
\psaxes[Dx=2,dx=2,Dy=2,dy=2,arrowlength=1.75,
ticksize=2pt,linewidth=0.17mm]{->}(0,0)(-8.5,-8.5)(9,9)
\rput[Br](9,-.7){$x$}
\rput[tr](-.3,9){$y$}
\rput[Br](-.3,-.7){$0$}
%
\psset{linewidth=.35mm,plotstyle=curve,polarplot}
\psplot[linecolor=blue]{0}{720}{8 2.5 x mul sin mul}
\end{pspicture}
\end{LTXexample}
\clearpage
\section{New macros}
\subsection{\nxLcs{psCoordinates}}
\begin{BDef}
\Lcs{psCoordinates}\OptArgs\Largr{\CAny}
\end{BDef}
A special optional argument is \Lkeyword{markPoint} which is preset to \texttt{true}. With
\Lkeyword{showpoints} one can set all three points with the same symbol: start point, curve point, and end point.
\medskip
\begin{LTXexample}[pos=t]
\begin{pspicture}(-5mm,-1cm)(10,10)
\psaxes{->}(10,10)
\psplot[algebraic,linecolor=red,linewidth=2pt]{0}{10}{x^2/10}
\psCoordinates(*1.5 {x^2/10})
\psCoordinates[showpoints](*2.2 {x^2/10})
\psCoordinates[linecolor=blue,linestyle=dashed,
dotstyle=square,dotscale=2](*4 {x^2/10})
\psCoordinates[arrowscale=1.5,arrows=->,markPoint=false](*6 {x^2/10})
\psCoordinates[linecolor=blue,linewidth=0.3pt,
dotstyle=x,dotscale=2,showpoints](*7 {x^2/10})
\psCoordinates[arrows=->,linecolor=blue,linestyle=dotted,
dotstyle=triangle,dotscale=2,showpoints](*8 {x^2/10})
\psCoordinates[dotscale=2](*9 {x^2/10})
\end{pspicture}
\end{LTXexample}
\clearpage
\subsection{\nxLcs{psFixpoint}}
\begin{BDef}
\Lcs{psFixpoint}\OptArgs\Largb{$x_0$}\Largb{$f(x)$}\Largb{$n$}
\end{BDef}
$x_0$ is the start value of the iteration, $f(x)$ the function, which can either be in
postfix or algebraic notation, for the latter it needs the optional argument \Lkeyword{algebraic}.
The number of the iteration is given by $n$.
\medskip
\begin{LTXexample}[pos=t]
\begin{pspicture}[algebraic](-5mm,-1cm)(10,10)
\psaxes{->}(10,10)
\psplot[linecolor=red,linewidth=2pt]{0}{10}{sqrt(5*x)}
\psline(10,10)
\psFixpoint[linecolor=blue]{9.5}{sqrt(5*x)}{20}
\psFixpoint[linestyle=dashed]{1}{sqrt(5*x)}{20}
\end{pspicture}
\end{LTXexample}
\clearpage
\subsection{\nxLcs{psNewton}}
\begin{BDef}
\Lcs{psNewton}\OptArgs\Largb{$x_0$}\Largb{$f(x)$}\OptArg*{\Largs{f'(x)}}\Largb{$n$}
\end{BDef}
If the optional derivation of the function $f(x)$ is missing, then the macro itself
calculates the derivation with an interval of $\pm0.01$. It can be changed by setting
the optional argument \Lkeyword{VarStepEpsilon} to another value. If the derivation
is also given as a function, it is used without any check for the values.
\medskip
\begin{LTXexample}[pos=t]
\def\f{1/5*x^3-x^2}
\psset{plotpoints=2000,algebraic}
%
\begin{pspicture*}[showgrid](-5.5,-8.5)(7.5,3.5)
\psaxes{->}(0,0)(-5,-8)(7,3)[$x$,270][$y$,0]
\psplot[linewidth=2pt,linecolor=blue]{-5}{8}{\f}
\uput[90](2.95,0){$x_0$}\uput[90](3.9,0){$x_0$}
\psNewton[linecolor=red,linewidth=0.5pt]{2.95}{\f}{10}
\psNewton[showpoints,linestyle=dashed]{3.9}{\f}{8}
\end{pspicture*}
\end{LTXexample}
$x_0$ is the start value of the iteration, $f(x)$ the function, which can either be in
postfix or algebraic notation, for the latter it needs the optional argument \Lkeyword{algebraic}.
The number of the iteration is given by $n$. All defined plotstyles can be used, but there
maybe PostScript errors for \Lkeyset{plotstyle=values} if the number of steps is too
big. In such a case decrease the number of steps.
\medskip
\begin{LTXexample}[pos=t]
\def\f{-(1/192)*x^3-(1/12)*x-(1/192)*Pi*x^2-(1/12)*Pi+2}
\def\fDerive{-(3/192)*x^2-(1/12)-(2/192)*Pi*x}
\psset{plotpoints=2000,unit=0.5,algebraic}
%
\begin{pspicture*}[showgrid](-16,-5)(8.5,18.5)
\psaxes[Dx=6,Dy=4]{->}(0,0)(-16,-5)(8,18)[$x$,270][$y$,0]
\psplot[algebraic,linewidth=2pt,linecolor=blue]{-20}{8}{\f}
\psxTick(-15){x_0}
\psNewton[linecolor=red,linewidth=0.5pt]{-15}{\f}{12}
\psNewton[linecolor=red,linewidth=0.5pt,plotstyle=xvalues,showDerivation=false]{-15}{\f}{6}
%
%-15, -9.567466932, -4.903526029, 3.026073041, 6.688396612, 5.580230655 (Made by Maple)
\end{pspicture*}
\end{LTXexample}
\clearpage
\subsection{\nxLcs{psVectorfield}}
\begin{BDef}
\Lcs{psVectorfield}\OptArgs\Largr{$x_0,y_0$}\Largr{$x_1,y_1$}\Largb{$f'(x,y)$}
\end{BDef}
$f'(x,y)$ can be in Postfix notation or with option \Lkeyword{algebraic} in
Infix notation. The $\Delta x$ and $\Delta y$ are given by \Lkeyword{Dx} and
\Lkeyword{Dy} and preset to 0.1, the length of the arrow lines is relative
and internally set by \texttt{1/}\Lkeyword{Ox} with a preset of \texttt{Ox=3}.
\medskip
\begin{center}
\includegraphics{data/\jobname}
\end{center}
\begin{lstlisting}
%\usepackage{pst-ode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%solve dy/dx=x^2 + y^2 - 1 numerically for different initial values of y in the
%interval x=[-1.1,1.1]; store resulting data points as tables into Postscript
%objects
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\psset{unit=3cm}
\begin{pspicture}(-1.2,-1.2)(1.1,1.1)
\psaxes[ticksize=0 4pt,axesstyle=frame,tickstyle=inner,subticks=20,
Ox=-1,Oy=-1](-1,-1)(1,1)
\psset{arrows=->,algebraic}
\psVectorfield[linecolor=black!60](-0.9,-0.9)(0.9,0.9){ x^2+y^2-1 }
%y0_a=-0.5
\pstODEsolve[algebraicOutputFormat]{y0_a}{t | x[0]}{-1}{1}{100}{-0.5}{t^2+x[0]^2-1}
%y0_b=0.0
\pstODEsolve[algebraicOutputFormat]{y0_b}{t | x[0]}{-1}{1}{100}{0.0}{t^2+x[0]^2-1}
%y0_c=0.5
\pstODEsolve[algebraicOutputFormat]{y0_c}{t | x[0]}{-1}{1}{100}{0.5}{t^2+x[0]^2-1}
\psset{arrows=-}%
\listplot[linecolor=red, linewidth=1pt]{y0_a}
\listplot[linecolor=green,linewidth=1pt]{y0_b}
\listplot[linecolor=blue, linewidth=1pt]{y0_c}
\end{pspicture}
\end{lstlisting}
\section{Internals}
The last pair of coordinates of \Lcs{psplot} and \Lcs{psparametricplot}
is saved in a PostScript array and can be used as \verb|FinalState|
inside PostScript code.
\medskip
\begin{LTXexample}[pos=t]
\psset{unit=2}
\begin{pspicture}(0,-1)(3,0.5)
\pscustom[linejoin=1,arrows=->]{%
\psline(0,-1)(1,0)
\psplot[algebraic,plotpoints=100]{1}{2.25}{.25*sin(2*Pi*x/.25)}
\psline(3,0)
}
%
\pscustom[linejoin=1,arrows=->,linecolor=red]{%
\psline(0,-1)(1,0)
\psplot[algebraic,plotpoints=100]{1}{2.25}{.25*sin(2*Pi*x/.25)}
\psline(! FinalState aload pop )(3,0)
}
\end{pspicture}
\end{LTXexample}
\clearpage
\section{List of all optional arguments for \texttt{pst-plot}}
\xkvview{family=pst-plot,columns={key,type,default}}
\nocite{*}
\bgroup
\RaggedRight
%\bibliographystyle{plain}
\printbibliography
\egroup
\printindex
\end{document}
|