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 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983
|
@c DO NOT EDIT! Generated automatically by munge-texi.pl.
@c Copyright (C) 1996-2013 John W. Eaton
@c
@c This file is part of Octave.
@c
@c Octave is free software; you can redistribute it and/or modify it
@c under the terms of the GNU General Public License as published by the
@c Free Software Foundation; either version 3 of the License, or (at
@c your option) any later version.
@c
@c Octave is distributed in the hope that it will be useful, but WITHOUT
@c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
@c for more details.
@c
@c You should have received a copy of the GNU General Public License
@c along with Octave; see the file COPYING. If not, see
@c <http://www.gnu.org/licenses/>.
@node Plotting
@chapter Plotting
@cindex plotting
@cindex graphics
@menu
* Introduction to Plotting::
* High-Level Plotting::
* Graphics Data Structures::
* Advanced Plotting::
@end menu
@node Introduction to Plotting
@section Introduction to Plotting
Earlier versions of Octave provided plotting through the use of
gnuplot. This capability is still available. But, a newer plotting
capability is provided by access to OpenGL@. Which plotting system
is used is controlled by the @code{graphics_toolkit} function.
@xref{Graphics Toolkits}.
The function call @code{graphics_toolkit ("fltk")} selects the
FLTK/OpenGL system, and @code{graphics_toolkit ("gnuplot")} selects the
gnuplot system. The two systems may be used selectively through the use
of the @code{graphics_toolkit} property of the graphics handle for each
figure. This is explained in @ref{Graphics Data Structures}.
@strong{Caution:} The FLTK toolkit uses single precision variables internally
which limits the maximum value that can be displayed to approximately
@math{10^{38}}. If your data contains larger values you must use the gnuplot
toolkit which supports values up to @math{10^{308}}.
@node High-Level Plotting
@section High-Level Plotting
@cindex plotting, high-level
Octave provides simple means to create many different types of two- and
three-dimensional plots using high-level functions.
If you need more detailed control, see @ref{Graphics Data Structures}
and @ref{Advanced Plotting}.
@menu
* Two-Dimensional Plots::
* Three-Dimensional Plots::
* Plot Annotations::
* Multiple Plots on One Page::
* Multiple Plot Windows::
* Manipulation of Plot Windows::
* Use of the @code{interpreter} Property::
* Printing and Saving Plots::
* Interacting with Plots::
* Test Plotting Functions::
@end menu
@node Two-Dimensional Plots
@subsection Two-Dimensional Plots
@menu
* Axis Configuration::
* Two-dimensional Function Plotting::
* Two-dimensional Geometric Shapes::
@end menu
The @code{plot} function allows you to create simple x-y plots with
linear axes. For example,
@example
@group
x = -10:0.1:10;
plot (x, sin (x));
@end group
@end example
@noindent
displays a sine wave shown in @ref{fig:plot}. On most systems, this
command will open a separate plot window to display the graph.
@float Figure,fig:plot
@center @image{plot,4in}
@caption{Simple Two-Dimensional Plot.}
@end float
@c plot scripts/plot/draw/plot.m
@anchor{XREFplot}
@deftypefn {Function File} {} plot (@var{y})
@deftypefnx {Function File} {} plot (@var{x}, @var{y})
@deftypefnx {Function File} {} plot (@var{x}, @var{y}, @var{fmt})
@deftypefnx {Function File} {} plot (@dots{}, @var{property}, @var{value}, @dots{})
@deftypefnx {Function File} {} plot (@var{x1}, @var{y1}, @dots{}, @var{xn}, @var{yn})
@deftypefnx {Function File} {} plot (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} plot (@dots{})
Produce 2-D plots.
Many different combinations of arguments are possible. The simplest
form is
@example
plot (@var{y})
@end example
@noindent
where the argument is taken as the set of @var{y} coordinates and the
@var{x} coordinates are taken to be the range @code{1:numel (@var{y})}.
If more than one argument is given, they are interpreted as
@example
plot (@var{y}, @var{property}, @var{value}, @dots{})
@end example
@noindent
or
@example
plot (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
@end example
@noindent
or
@example
plot (@var{x}, @var{y}, @var{fmt}, @dots{})
@end example
@noindent
and so on. Any number of argument sets may appear. The @var{x} and
@var{y} values are interpreted as follows:
@itemize @bullet
@item
If a single data argument is supplied, it is taken as the set of @var{y}
coordinates and the @var{x} coordinates are taken to be the indices of
the elements, starting with 1.
@item
If @var{x} and @var{y} are scalars, a single point is plotted.
@item
@code{squeeze()} is applied to arguments with more than two dimensions,
but no more than two singleton dimensions.
@item
If both arguments are vectors, the elements of @var{y} are plotted versus
the elements of @var{x}.
@item
If @var{x} is a vector and @var{y} is a matrix, then
the columns (or rows) of @var{y} are plotted versus @var{x}.
(using whichever combination matches, with columns tried first.)
@item
If the @var{x} is a matrix and @var{y} is a vector,
@var{y} is plotted versus the columns (or rows) of @var{x}.
(using whichever combination matches, with columns tried first.)
@item
If both arguments are matrices, the columns of @var{y} are plotted
versus the columns of @var{x}. In this case, both matrices must have
the same number of rows and columns and no attempt is made to transpose
the arguments to make the number of rows match.
@end itemize
Multiple property-value pairs may be specified, but they must appear
in pairs. These arguments are applied to the line objects drawn by
@code{plot}. Useful properties to modify are @qcode{"linestyle"},
@qcode{"linewidth"}, @qcode{"color"}, @qcode{"marker"},
@qcode{"markersize"}, @qcode{"markeredgecolor"}, @qcode{"markerfacecolor"}.
The @var{fmt} format argument can also be used to control the plot style.
The format is composed of three parts: linestyle, markerstyle, color.
When a markerstyle is specified, but no linestyle, only the markers are
plotted. Similarly, if a linestyle is specified, but no markerstyle, then
only lines are drawn. If both are specified then lines and markers will
be plotted. If no @var{fmt} and no @var{property}/@var{value} pairs are
given, then the default plot style is solid lines with no markers and the
color determined by the @qcode{"colororder"} property of the current axes.
Format arguments:
@table @asis
@item linestyle
@multitable @columnfractions 0.06 0.94
@item @samp{-} @tab Use solid lines (default).
@item @samp{--} @tab Use dashed lines.
@item @samp{:} @tab Use dotted lines.
@item @samp{-.} @tab Use dash-dotted lines.
@end multitable
@item markerstyle
@multitable @columnfractions 0.06 0.94
@item @samp{+} @tab crosshair
@item @samp{o} @tab circle
@item @samp{*} @tab star
@item @samp{.} @tab point
@item @samp{x} @tab cross
@item @samp{s} @tab square
@item @samp{d} @tab diamond
@item @samp{^} @tab upward-facing triangle
@item @samp{v} @tab downward-facing triangle
@item @samp{>} @tab right-facing triangle
@item @samp{<} @tab left-facing triangle
@item @samp{p} @tab pentagram
@item @samp{h} @tab hexagram
@end multitable
@item color
@multitable @columnfractions 0.06 0.94
@item @samp{k} @tab blacK
@item @samp{r} @tab Red
@item @samp{g} @tab Green
@item @samp{b} @tab Blue
@item @samp{m} @tab Magenta
@item @samp{c} @tab Cyan
@item @samp{w} @tab White
@end multitable
@item @qcode{";key;"}
Here @qcode{"key"} is the label to use for the plot legend.
@end table
The @var{fmt} argument may also be used to assign legend keys.
To do so, include the desired label between semicolons after the
formatting sequence described above, e.g., @qcode{"+b;Key Title;"}.
Note that the last semicolon is required and Octave will generate
an error if it is left out.
Here are some plot examples:
@example
plot (x, y, "or", x, y2, x, y3, "m", x, y4, "+")
@end example
This command will plot @code{y} with red circles, @code{y2} with solid
lines, @code{y3} with solid magenta lines, and @code{y4} with points
displayed as @samp{+}.
@example
plot (b, "*", "markersize", 10)
@end example
This command will plot the data in the variable @code{b},
with points displayed as @samp{*} and a marker size of 10.
@example
@group
t = 0:0.1:6.3;
plot (t, cos(t), "-;cos(t);", t, sin(t), "-b;sin(t);");
@end group
@end example
This will plot the cosine and sine functions and label them accordingly
in the legend.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a vector of graphics handles to
the created line objects.
To save a plot, in one of several image formats such as PostScript
or PNG, use the @code{print} command.
@seealso{@ref{XREFaxis,,axis}, @ref{XREFbox,,box}, @ref{XREFgrid,,grid}, @ref{XREFhold,,hold}, @ref{XREFlegend,,legend}, @ref{XREFtitle,,title}, @ref{XREFxlabel,,xlabel}, @ref{XREFylabel,,ylabel}, @ref{XREFxlim,,xlim}, @ref{XREFylim,,ylim}, @ref{XREFezplot,,ezplot}, @ref{XREFerrorbar,,errorbar}, @ref{XREFfplot,,fplot}, @ref{XREFline,,line}, @ref{XREFplot3,,plot3}, @ref{XREFpolar,,polar}, @ref{XREFloglog,,loglog}, @ref{XREFsemilogx,,semilogx}, @ref{XREFsemilogy,,semilogy}, @ref{XREFsubplot,,subplot}}
@end deftypefn
The @code{plotyy} function may be used to create a plot with two
independent y axes.
@c plotyy scripts/plot/draw/plotyy.m
@anchor{XREFplotyy}
@deftypefn {Function File} {} plotyy (@var{x1}, @var{y1}, @var{x2}, @var{y2})
@deftypefnx {Function File} {} plotyy (@dots{}, @var{fun})
@deftypefnx {Function File} {} plotyy (@dots{}, @var{fun1}, @var{fun2})
@deftypefnx {Function File} {} plotyy (@var{hax}, @dots{})
@deftypefnx {Function File} {[@var{ax}, @var{h1}, @var{h2}] =} plotyy (@dots{})
Plot two sets of data with independent y-axes.
The arguments @var{x1} and @var{y1} define the arguments for the first plot
and @var{x1} and @var{y2} for the second.
By default the arguments are evaluated with
@code{feval (@@plot, @var{x}, @var{y})}. However the type of plot can be
modified with the @var{fun} argument, in which case the plots are
generated by @code{feval (@var{fun}, @var{x}, @var{y})}. @var{fun} can be
a function handle, an inline function, or a string of a function name.
The function to use for each of the plots can be independently defined
with @var{fun1} and @var{fun2}.
If the first argument @var{hax} is an axes handle, then it defines
the principal axis in which to plot the @var{x1} and @var{y1} data.
The return value @var{ax} is a vector with the axis handles of the two
y axes. @var{h1} and @var{h2} are handles to the objects generated by the
plot commands.
@example
@group
x = 0:0.1:2*pi;
y1 = sin (x);
y2 = exp (x - 1);
ax = plotyy (x, y1, x - 1, y2, @@plot, @@semilogy);
xlabel ("X");
ylabel (ax(1), "Axis 1");
ylabel (ax(2), "Axis 2");
@end group
@end example
@seealso{@ref{XREFplot,,plot}}
@end deftypefn
The functions @code{semilogx}, @code{semilogy}, and @code{loglog} are
similar to the @code{plot} function, but produce plots in which one or
both of the axes use log scales.
@c semilogx scripts/plot/draw/semilogx.m
@anchor{XREFsemilogx}
@deftypefn {Function File} {} semilogx (@var{y})
@deftypefnx {Function File} {} semilogx (@var{x}, @var{y})
@deftypefnx {Function File} {} semilogx (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
@deftypefnx {Function File} {} semilogx (@var{x}, @var{y}, @var{fmt})
@deftypefnx {Function File} {} semilogx (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} semilogx (@dots{})
Produce a 2-D plot using a logarithmic scale for the x-axis.
See the documentation of @code{plot} for a description of the
arguments that @code{semilogx} will accept.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created plot.
@seealso{@ref{XREFplot,,plot}, @ref{XREFsemilogy,,semilogy}, @ref{XREFloglog,,loglog}}
@end deftypefn
@c semilogy scripts/plot/draw/semilogy.m
@anchor{XREFsemilogy}
@deftypefn {Function File} {} semilogy (@var{y})
@deftypefnx {Function File} {} semilogy (@var{x}, @var{y})
@deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
@deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{fmt})
@deftypefnx {Function File} {} semilogy (@var{h}, @dots{})
@deftypefnx {Function File} {@var{h} =} semilogy (@dots{})
Produce a 2-D plot using a logarithmic scale for the y-axis.
See the documentation of @code{plot} for a description of the
arguments that @code{semilogy} will accept.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created plot.
@seealso{@ref{XREFplot,,plot}, @ref{XREFsemilogx,,semilogx}, @ref{XREFloglog,,loglog}}
@end deftypefn
@c loglog scripts/plot/draw/loglog.m
@anchor{XREFloglog}
@deftypefn {Function File} {} loglog (@var{y})
@deftypefnx {Function File} {} loglog (@var{x}, @var{y})
@deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{prop}, @var{value}, @dots{})
@deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{fmt})
@deftypefnx {Function File} {} loglog (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} loglog (@dots{})
Produce a 2-D plot using logarithmic scales for both axes.
See the documentation of @code{plot} for a description of the arguments
that @code{loglog} will accept.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created plot.
@seealso{@ref{XREFplot,,plot}, @ref{XREFsemilogx,,semilogx}, @ref{XREFsemilogy,,semilogy}}
@end deftypefn
The functions @code{bar}, @code{barh}, @code{stairs}, and @code{stem}
are useful for displaying discrete data. For example,
@example
@group
hist (randn (10000, 1), 30);
@end group
@end example
@noindent
produces the histogram of 10,000 normally distributed random numbers
shown in @ref{fig:hist}.
@float Figure,fig:hist
@center @image{hist,4in}
@caption{Histogram.}
@end float
@c bar scripts/plot/draw/bar.m
@anchor{XREFbar}
@deftypefn {Function File} {} bar (@var{y})
@deftypefnx {Function File} {} bar (@var{x}, @var{y})
@deftypefnx {Function File} {} bar (@dots{}, @var{w})
@deftypefnx {Function File} {} bar (@dots{}, @var{style})
@deftypefnx {Function File} {} bar (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} bar (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} bar (@dots{}, @var{prop}, @var{val}, @dots{})
Produce a bar graph from two vectors of X-Y data.
If only one argument is given, @var{y}, it is taken as a vector of Y values
and the X coordinates are the range @code{1:numel (@var{y})}.
The optional input @var{w} controls the width of the bars. A value of
1.0 will cause each bar to exactly touch any adjacent bars.
The default width is 0.8.
If @var{y} is a matrix, then each column of @var{y} is taken to be a
separate bar graph plotted on the same graph. By default the columns
are plotted side-by-side. This behavior can be changed by the @var{style}
argument which can take the following values:
@table @asis
@item @qcode{"grouped"} (default)
Side-by-side bars with a gap between bars and centered over the X-coordinate.
@item @qcode{"stacked"}
Bars are stacked so that each X value has a single bar composed of
multiple segments.
@item @qcode{"hist"}
Side-by-side bars with no gap between bars and centered over the
X-coordinate.
@item @qcode{"histc"}
Side-by-side bars with no gap between bars and left-aligned to the
X-coordinate.
@end table
Optional property/value pairs are passed directly to the underlying patch
objects.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a vector of handles to the created
"bar series" hggroups with one handle per column of the variable @var{y}.
This series makes it possible to change a common element in one bar series
object and have the change reflected in the other "bar series".
For example,
@example
@group
h = bar (rand (5, 10));
set (h(1), "basevalue", 0.5);
@end group
@end example
@noindent
changes the position on the base of all of the bar series.
The following example modifies the face and edge colors using
property/value pairs.
@example
bar (randn (1, 100), "facecolor", "r", "edgecolor", "b");
@end example
@noindent
The color of the bars is taken from the figure's colormap, such that
@example
@group
bar (rand (10, 3));
colormap (summer (64));
@end group
@end example
@noindent
will change the colors used for the bars. The color of bars can also be set
manually using the @qcode{"facecolor"} property as shown below.
@example
@group
h = bar (rand (10, 3));
set (h(1), "facecolor", "r")
set (h(2), "facecolor", "g")
set (h(3), "facecolor", "b")
@end group
@end example
@seealso{@ref{XREFbarh,,barh}, @ref{XREFhist,,hist}, @ref{XREFpie,,pie}, @ref{XREFplot,,plot}, @ref{XREFpatch,,patch}}
@end deftypefn
@c barh scripts/plot/draw/barh.m
@anchor{XREFbarh}
@deftypefn {Function File} {} barh (@var{y})
@deftypefnx {Function File} {} barh (@var{x}, @var{y})
@deftypefnx {Function File} {} barh (@dots{}, @var{w})
@deftypefnx {Function File} {} barh (@dots{}, @var{style})
@deftypefnx {Function File} {} barh (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} barh (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} barh (@dots{}, @var{prop}, @var{val}, @dots{})
Produce a horizontal bar graph from two vectors of X-Y data.
If only one argument is given, it is taken as a vector of Y values
and the X coordinates are the range @code{1:numel (@var{y})}.
The optional input @var{w} controls the width of the bars. A value of
1.0 will cause each bar to exactly touch any adjacent bars.
The default width is 0.8.
If @var{y} is a matrix, then each column of @var{y} is taken to be a
separate bar graph plotted on the same graph. By default the columns
are plotted side-by-side. This behavior can be changed by the @var{style}
argument which can take the following values:
@table @asis
@item @qcode{"grouped"} (default)
Side-by-side bars with a gap between bars and centered over the Y-coordinate.
@item @qcode{"stacked"}
Bars are stacked so that each Y value has a single bar composed of
multiple segments.
@item @qcode{"hist"}
Side-by-side bars with no gap between bars and centered over the
Y-coordinate.
@item @qcode{"histc"}
Side-by-side bars with no gap between bars and left-aligned to the
Y-coordinate.
@end table
Optional property/value pairs are passed directly to the underlying patch
objects.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
bar series hggroup. For a description of the use of the
bar series, @pxref{XREFbar,,bar}.
@seealso{@ref{XREFbar,,bar}, @ref{XREFhist,,hist}, @ref{XREFpie,,pie}, @ref{XREFplot,,plot}, @ref{XREFpatch,,patch}}
@end deftypefn
@c hist scripts/plot/draw/hist.m
@anchor{XREFhist}
@deftypefn {Function File} {} hist (@var{y})
@deftypefnx {Function File} {} hist (@var{y}, @var{x})
@deftypefnx {Function File} {} hist (@var{y}, @var{nbins})
@deftypefnx {Function File} {} hist (@var{y}, @var{x}, @var{norm})
@deftypefnx {Function File} {} hist (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} hist (@var{hax}, @dots{})
@deftypefnx {Function File} {[@var{nn}, @var{xx}] =} hist (@dots{})
Produce histogram counts or plots.
With one vector input argument, @var{y}, plot a histogram of the values
with 10 bins. The range of the histogram bins is determined by the
range of the data. With one matrix input argument, @var{y}, plot a
histogram where each bin contains a bar per input column.
Given a second vector argument, @var{x}, use that as the centers of
the bins, with the width of the bins determined from the adjacent
values in the vector.
If scalar, the second argument, @var{nbins}, defines the number of bins.
If a third argument is provided, the histogram is normalized such that
the sum of the bars is equal to @var{norm}.
Extreme values are lumped into the first and last bins.
The histogram's appearance may be modified by specifying property/value
pairs. For example the face and edge color may be modified.
@example
@group
hist (randn (1, 100), 25, "facecolor", "r", "edgecolor", "b");
@end group
@end example
@noindent
The histogram's colors also depend upon the current colormap.
@example
@group
hist (rand (10, 3));
colormap (summer ());
@end group
@end example
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
With two output arguments, produce the values @var{nn} (numbers of elements)
and @var{xx} (bin centers) such that @code{bar (@var{xx}, @var{nn})} will
plot the histogram.
@seealso{@ref{XREFhistc,,histc}, @ref{XREFbar,,bar}, @ref{XREFpie,,pie}, @ref{XREFrose,,rose}}
@end deftypefn
@c stemleaf scripts/plot/draw/stemleaf.m
@anchor{XREFstemleaf}
@deftypefn {Function File} {} stemleaf (@var{x}, @var{caption})
@deftypefnx {Function File} {} stemleaf (@var{x}, @var{caption}, @var{stem_sz})
@deftypefnx {Function File} {@var{plotstr} =} stemleaf (@dots{})
Compute and display a stem and leaf plot of the vector @var{x}.
The input @var{x} should be a vector of integers. Any non-integer values
will be converted to integer by @code{@var{x} = fix (@var{x})}. By default
each element of @var{x} will be plotted with the last digit of the element
as a leaf value and the remaining digits as the stem. For example, 123
will be plotted with the stem @samp{12} and the leaf @samp{3}. The second
argument, @var{caption}, should be a character array which provides a
description of the data. It is included as a heading for the output.
The optional input @var{stem_sz} sets the width of each stem.
The stem width is determined by @code{10^(@var{stem_sz} + 1)}.
The default stem width is 10.
The output of @code{stemleaf} is composed of two parts: a
"Fenced Letter Display," followed by the stem-and-leaf plot itself.
The Fenced Letter Display is described in @cite{Exploratory Data Analysis}.
Briefly, the entries are as shown:
@example
@group
Fenced Letter Display
#% nx|___________________ nx = numel (x)
M% mi| md | mi median index, md median
H% hi|hl hu| hs hi lower hinge index, hl,hu hinges,
1 |x(1) x(nx)| hs h_spreadx(1), x(nx) first
_______ and last data value.
______|step |_______ step 1.5*h_spread
f|ifl ifh| inner fence, lower and higher
|nfl nfh| no.\ of data points within fences
F|ofl ofh| outer fence, lower and higher
|nFl nFh| no.\ of data points outside outer
fences
@end group
@end example
The stem-and-leaf plot shows on each line the stem value followed by the
string made up of the leaf digits. If the @var{stem_sz} is not 1 the
successive leaf values are separated by ",".
With no return argument, the plot is immediately displayed. If an output
argument is provided, the plot is returned as an array of strings.
The leaf digits are not sorted. If sorted leaf values are desired, use
@code{@var{xs} = sort (@var{x})} before calling @code{stemleaf (@var{xs})}.
The stem and leaf plot and associated displays are described in:
Ch. 3, @cite{Exploratory Data Analysis} by J. W. Tukey, Addison-Wesley, 1977.
@seealso{@ref{XREFhist,,hist}, @ref{XREFprintd,,printd}}
@end deftypefn
@c printd scripts/plot/util/printd.m
@anchor{XREFprintd}
@deftypefn {Function File} {} printd (@var{obj}, @var{filename})
@deftypefnx {Function File} {@var{out_file} =} printd (@dots{})
Convert any object acceptable to @code{disp} into the format
selected by the suffix of @var{filename}. If the return argument
@var{out_file} is given, the name of the created file is returned.
This function is intended to facilitate manipulation of the output
of functions such as @code{stemleaf}.
@seealso{@ref{XREFstemleaf,,stemleaf}}
@end deftypefn
@c stairs scripts/plot/draw/stairs.m
@anchor{XREFstairs}
@deftypefn {Function File} {} stairs (@var{y})
@deftypefnx {Function File} {} stairs (@var{x}, @var{y})
@deftypefnx {Function File} {} stairs (@dots{}, @var{style})
@deftypefnx {Function File} {} stairs (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} stairs (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} stairs (@dots{})
@deftypefnx {Function File} {[@var{xstep}, @var{ystep}] =} stairs (@dots{})
Produce a stairstep plot.
The arguments @var{x} and @var{y} may be vectors or matrices.
If only one argument is given, it is taken as a vector of Y values
and the X coordinates are taken to be the indices of the elements.
The style to use for the plot can be defined with a line style @var{style}
of the same format as the @code{plot} command.
Multiple property/value pairs may be specified, but they must appear in
pairs.
If the first argument @var{hax} is an axis handle, then plot into this axis,
rather than the current axis handle returned by @code{gca}.
If one output argument is requested, return a graphics handle to the
created plot. If two output arguments are specified, the data are generated
but not plotted. For example,
@example
stairs (x, y);
@end example
@noindent
and
@example
@group
[xs, ys] = stairs (x, y);
plot (xs, ys);
@end group
@end example
@noindent
are equivalent.
@seealso{@ref{XREFbar,,bar}, @ref{XREFhist,,hist}, @ref{XREFplot,,plot}, @ref{XREFstem,,stem}}
@end deftypefn
@c stem scripts/plot/draw/stem.m
@anchor{XREFstem}
@deftypefn {Function File} {} stem (@var{y})
@deftypefnx {Function File} {} stem (@var{x}, @var{y})
@deftypefnx {Function File} {} stem (@dots{}, @var{linespec})
@deftypefnx {Function File} {} stem (@dots{}, "filled")
@deftypefnx {Function File} {} stem (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} stem (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} stem (@dots{})
Plot a 2-D stem graph.
If only one argument is given, it is taken as the y-values and the
x-coordinates are taken from the indices of the elements.
If @var{y} is a matrix, then each column of the matrix is plotted as
a separate stem graph. In this case @var{x} can either be a vector,
the same length as the number of rows in @var{y}, or it can be a
matrix of the same size as @var{y}.
The default color is @qcode{"b"} (blue), the default line style is
@qcode{"-"}, and the default marker is @qcode{"o"}. The line style can
be altered by the @code{linespec} argument in the same manner as the
@code{plot} command. If the @qcode{"filled"} argument is present the
markers at the top of the stems will be filled in. For example,
@example
@group
x = 1:10;
y = 2*x;
stem (x, y, "r");
@end group
@end example
@noindent
plots 10 stems with heights from 2 to 20 in red;
Optional property/value pairs may be specified to control the appearance
of the plot.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a handle to a @nospell{"stem series"}
hggroup. The single hggroup handle has all of the graphical elements
comprising the plot as its children; This allows the properties of
multiple graphics objects to be changed by modifying just a single
property of the @nospell{"stem series"} hggroup.
For example,
@example
@group
x = [0:10]';
y = [sin(x), cos(x)]
h = stem (x, y);
set (h(2), "color", "g");
set (h(1), "basevalue", -1)
@end group
@end example
@noindent
changes the color of the second @nospell{"stem series"} and moves the base
line of the first.
Stem Series Properties
@table @asis
@item linestyle
The linestyle of the stem. (Default: @qcode{"-"})
@item linewidth
The width of the stem. (Default: 0.5)
@item color
The color of the stem, and if not separately specified, the marker.
(Default: @qcode{"b"} [blue])
@item marker
The marker symbol to use at the top of each stem. (Default: @qcode{"o"})
@item markeredgecolor
The edge color of the marker. (Default: @qcode{"color"} property)
@item markerfacecolor
The color to use for @nospell{"filling"} the marker.
(Default: @qcode{"none"} [unfilled])
@item markersize
The size of the marker. (Default: 6)
@item baseline
The handle of the line object which implements the baseline. Use @code{set}
with the returned handle to change graphic properties of the baseline.
@item basevalue
The y-value where the baseline is drawn. (Default: 0)
@end table
@seealso{@ref{XREFstem3,,stem3}, @ref{XREFbar,,bar}, @ref{XREFhist,,hist}, @ref{XREFplot,,plot}, @ref{XREFstairs,,stairs}}
@end deftypefn
@c stem3 scripts/plot/draw/stem3.m
@anchor{XREFstem3}
@deftypefn {Function File} {} stem3 (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} stem3 (@dots{}, @var{linespec})
@deftypefnx {Function File} {} stem3 (@dots{}, "filled")
@deftypefnx {Function File} {} stem3 (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} stem3 (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} stem3 (@dots{})
Plot a 3-D stem graph.
Stems are drawn from the height @var{z} to the location in the x-y plane
determined by @var{x} and @var{y}. The default color is @qcode{"b"} (blue),
the default line style is @qcode{"-"}, and the default marker is @qcode{"o"}.
The line style can be altered by the @code{linespec} argument in the same
manner as the @code{plot} command. If the @qcode{"filled"} argument is
present the markers at the top of the stems will be filled in.
Optional property/value pairs may be specified to control the appearance
of the plot.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a handle to the @nospell{"stem series"}
hggroup containing the line and marker objects used for the plot.
@xref{XREFstem,,stem}, for a description of the @nospell{"stem series"}
object.
Example:
@example
@group
theta = 0:0.2:6;
stem3 (cos (theta), sin (theta), theta);
@end group
@end example
@noindent
plots 31 stems with heights from 0 to 6 lying on a circle.
Implementation Note: Color definitions with RGB-triples are not valid.
@seealso{@ref{XREFstem,,stem}, @ref{XREFbar,,bar}, @ref{XREFhist,,hist}, @ref{XREFplot,,plot}}
@end deftypefn
@c scatter scripts/plot/draw/scatter.m
@anchor{XREFscatter}
@deftypefn {Function File} {} scatter (@var{x}, @var{y})
@deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s})
@deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s}, @var{c})
@deftypefnx {Function File} {} scatter (@dots{}, @var{style})
@deftypefnx {Function File} {} scatter (@dots{}, "filled")
@deftypefnx {Function File} {} scatter (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} scatter (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} scatter (@dots{})
Draw a 2-D scatter plot.
A marker is plotted at each point defined by the coordinates in the vectors
@var{x} and @var{y}.
The size of the markers is determined by @var{s}, which can be a scalar
or a vector of the same length as @var{x} and @var{y}. If @var{s}
is not given, or is an empty matrix, then a default value of 8 points is
used.
The color of the markers is determined by @var{c}, which can be a string
defining a fixed color; a 3-element vector giving the red, green, and blue
components of the color; a vector of the same length as @var{x} that gives
a scaled index into the current colormap; or an @nospell{Nx3} matrix defining
the RGB color of each marker individually.
The marker to use can be changed with the @var{style} argument, that is a
string defining a marker in the same manner as the @code{plot} command.
If no marker is specified it defaults to @qcode{"o"} or circles.
If the argument @qcode{"filled"} is given then the markers are filled.
Additional property/value pairs are passed directly to the underlying
patch object.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created patch
object.
Example:
@example
@group
x = randn (100, 1);
y = randn (100, 1);
scatter (x, y, [], sqrt (x.^2 + y.^2));
@end group
@end example
@seealso{@ref{XREFscatter3,,scatter3}, @ref{XREFpatch,,patch}, @ref{XREFplot,,plot}}
@end deftypefn
@c plotmatrix scripts/plot/draw/plotmatrix.m
@anchor{XREFplotmatrix}
@deftypefn {Function File} {} plotmatrix (@var{x}, @var{y})
@deftypefnx {Function File} {} plotmatrix (@var{x})
@deftypefnx {Function File} {} plotmatrix (@dots{}, @var{style})
@deftypefnx {Function File} {} plotmatrix (@var{hax}, @dots{})
@deftypefnx {Function File} {[@var{h}, @var{ax}, @var{bigax}, @var{p}, @var{pax}] =} plotmatrix (@dots{})
Scatter plot of the columns of one matrix against another.
Given the arguments @var{x} and @var{y}, that have a matching number of
rows, @code{plotmatrix} plots a set of axes corresponding to
@example
plot (@var{x}(:, i), @var{y}(:, j))
@end example
Given a single argument @var{x} this is equivalent to
@example
plotmatrix (@var{x}, @var{x})
@end example
@noindent
except that the diagonal of the set of axes will be replaced with the
histogram @code{hist (@var{x}(:, i))}.
The marker to use can be changed with the @var{style} argument, that is a
string defining a marker in the same manner as the @code{plot} command.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} provides handles to the individual
graphics objects in the scatter plots, whereas @var{ax} returns the
handles to the scatter plot axis objects. @var{bigax} is a hidden
axis object that surrounds the other axes, such that the commands
@code{xlabel}, @code{title}, etc., will be associated with this hidden
axis. Finally, @var{p} returns the graphics objects associated with
the histogram and @var{pax} the corresponding axes objects.
Example:
@example
plotmatrix (randn (100, 3), "g+")
@end example
@seealso{@ref{XREFscatter,,scatter}, @ref{XREFplot,,plot}}
@end deftypefn
@c pareto scripts/plot/draw/pareto.m
@anchor{XREFpareto}
@deftypefn {Function File} {} pareto (@var{y})
@deftypefnx {Function File} {} pareto (@var{y}, @var{x})
@deftypefnx {Function File} {} pareto (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} pareto (@dots{})
Draw a Pareto chart.
A Pareto chart is a bar graph that arranges information in such a way
that priorities for process improvement can be established; It organizes
and displays information to show the relative importance of data. The chart
is similar to the histogram or bar chart, except that the bars are arranged
in decreasing magnitude from left to right along the x-axis.
The fundamental idea (Pareto principle) behind the use of Pareto
diagrams is that the majority of an effect is due to a small subset of the
causes. For quality improvement, the first few contributing causes
(leftmost bars as presented on the diagram) to a problem usually account for
the majority of the result. Thus, targeting these "major causes" for
elimination results in the most cost-effective improvement scheme.
Typically only the magnitude data @var{y} is present in which case
@var{x} is taken to be the range @code{1 : length (@var{y})}. If @var{x}
is given it may be a string array, a cell array of strings, or a numerical
vector.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a 2-element vector with a graphics
handle for the created bar plot and a second handle for the created line
plot.
An example of the use of @code{pareto} is
@example
@group
Cheese = @{"Cheddar", "Swiss", "Camembert", ...
"Munster", "Stilton", "Blue"@};
Sold = [105, 30, 70, 10, 15, 20];
pareto (Sold, Cheese);
@end group
@end example
@seealso{@ref{XREFbar,,bar}, @ref{XREFbarh,,barh}, @ref{XREFhist,,hist}, @ref{XREFpie,,pie}, @ref{XREFplot,,plot}}
@end deftypefn
@c rose scripts/plot/draw/rose.m
@anchor{XREFrose}
@deftypefn {Function File} {} rose (@var{th})
@deftypefnx {Function File} {} rose (@var{th}, @var{nbins})
@deftypefnx {Function File} {} rose (@var{th}, @var{bins})
@deftypefnx {Function File} {} rose (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} rose (@dots{})
@deftypefnx {Function File} {[@var{thout} @var{rout}] =} rose (@dots{})
Plot an angular histogram.
With one vector argument, @var{th}, plot the histogram with 20 angular bins.
If @var{th} is a matrix then each column of @var{th} produces a separate
histogram.
If @var{nbins} is given and is a scalar, then the histogram is produced with
@var{nbin} bins. If @var{bins} is a vector, then the center of each bin is
defined by the values of @var{bins} and the number of bins is
given by the number of elements in @var{bins}.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a vector of graphics handles to the
line objects representing each histogram.
If two output arguments are requested then no plot is made and
the polar vectors necessary to plot the histogram are returned instead.
@example
@group
[th, r] = rose ([2*randn(1e5,1), pi + 2*randn(1e5,1)]);
polar (th, r);
@end group
@end example
@seealso{@ref{XREFhist,,hist}, @ref{XREFpolar,,polar}}
@end deftypefn
The @code{contour}, @code{contourf} and @code{contourc} functions
produce two-dimensional contour plots from three-dimensional data.
@c contour scripts/plot/draw/contour.m
@anchor{XREFcontour}
@deftypefn {Function File} {} contour (@var{z})
@deftypefnx {Function File} {} contour (@var{z}, @var{vn})
@deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z}, @var{vn})
@deftypefnx {Function File} {} contour (@dots{}, @var{style})
@deftypefnx {Function File} {} contour (@var{hax}, @dots{})
@deftypefnx {Function File} {[@var{c}, @var{h}] =} contour (@dots{})
Create a 2-D contour plot.
Plot level curves (contour lines) of the matrix @var{z}, using the
contour matrix @var{c} computed by @code{contourc} from the same
arguments; see the latter for their interpretation.
The appearance of contour lines can be defined with a line style @var{style}
in the same manner as @code{plot}. Only line style and color are used;
Any markers defined by @var{style} are ignored.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional output @var{c} are the contour levels in @code{contourc} format.
The optional return value @var{h} is a graphics handle to the hggroup
comprising the contour lines.
Example:
@example
@group
x = 0:2;
y = x;
z = x' * y;
contour (x, y, z, 2:3)
@end group
@end example
@seealso{@ref{XREFezcontour,,ezcontour}, @ref{XREFcontourc,,contourc}, @ref{XREFcontourf,,contourf}, @ref{XREFcontour3,,contour3}, @ref{XREFclabel,,clabel}, @ref{XREFmeshc,,meshc}, @ref{XREFsurfc,,surfc}, @ref{XREFcaxis,,caxis}, @ref{XREFcolormap,,colormap}, @ref{XREFplot,,plot}}
@end deftypefn
@c contourf scripts/plot/draw/contourf.m
@anchor{XREFcontourf}
@deftypefn {Function File} {} contourf (@var{z})
@deftypefnx {Function File} {} contourf (@var{z}, @var{vn})
@deftypefnx {Function File} {} contourf (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} contourf (@var{x}, @var{y}, @var{z}, @var{vn})
@deftypefnx {Function File} {} contourf (@dots{}, @var{style})
@deftypefnx {Function File} {} contourf (@var{hax}, @dots{})
@deftypefnx {Function File} {[@var{c}, @var{h}] =} contourf (@dots{})
Create a 2-D contour plot with filled intervals.
Plot level curves (contour lines) of the matrix @var{z} and fill the region
between lines with colors from the current colormap.
The level curves are taken from the contour matrix @var{c} computed by
@code{contourc} for the same arguments; see the latter for their
interpretation.
The appearance of contour lines can be defined with a line style @var{style}
in the same manner as @code{plot}. Only line style and color are used;
Any markers defined by @var{style} are ignored.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional output @var{c} are the contour levels in @code{contourc} format.
The optional return value @var{h} is a graphics handle to the hggroup
comprising the contour lines.
The following example plots filled contours of the @code{peaks} function.
@example
@group
[x, y, z] = peaks (50);
contourf (x, y, z, -7:9)
@end group
@end example
@seealso{@ref{XREFezcontourf,,ezcontourf}, @ref{XREFcontour,,contour}, @ref{XREFcontourc,,contourc}, @ref{XREFcontour3,,contour3}, @ref{XREFclabel,,clabel}, @ref{XREFmeshc,,meshc}, @ref{XREFsurfc,,surfc}, @ref{XREFcaxis,,caxis}, @ref{XREFcolormap,,colormap}, @ref{XREFplot,,plot}}
@end deftypefn
@c contourc scripts/plot/draw/contourc.m
@anchor{XREFcontourc}
@deftypefn {Function File} {[@var{c}, @var{lev}] =} contourc (@var{z})
@deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{z}, @var{vn})
@deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z}, @var{vn})
Compute contour lines (isolines of constant Z value).
The matrix @var{z} contains height values above the rectangular grid
determined by @var{x} and @var{y}. If only a single input @var{z} is
provided then @var{x} is taken to be @code{1:rows (@var{z})} and @var{y} is
taken to be @code{1:columns (@var{z})}.
The optional input @var{vn} is either a scalar denoting the number of
contour lines to compute or a vector containing the Z values where lines
will be computed. When @var{vn} is a vector the number of contour lines
is @code{numel (@var{vn})}. However, to compute a single contour line
at a given value use @code{@var{vn} = [val, val]}. If @var{vn} is omitted
it defaults to 10.
The return value @var{c} is a 2x@var{n} matrix containing the
contour lines in the following format
@example
@group
@var{c} = [lev1, x1, x2, @dots{}, levn, x1, x2, ...
len1, y1, y2, @dots{}, lenn, y1, y2, @dots{}]
@end group
@end example
@noindent
in which contour line @var{n} has a level (height) of @var{levn} and
length of @var{lenn}.
The optional return value @var{lev} is a vector with the Z values of
of the contour levels.
Example:
@example
@group
x = 0:2;
y = x;
z = x' * y;
contourc (x, y, z, 2:3)
@result{} 2.0000 2.0000 1.0000 3.0000 1.5000 2.0000
2.0000 1.0000 2.0000 2.0000 2.0000 1.5000
@end group
@end example
@seealso{@ref{XREFcontour,,contour}, @ref{XREFcontourf,,contourf}, @ref{XREFcontour3,,contour3}, @ref{XREFclabel,,clabel}}
@end deftypefn
@c contour3 scripts/plot/draw/contour3.m
@anchor{XREFcontour3}
@deftypefn {Function File} {} contour3 (@var{z})
@deftypefnx {Function File} {} contour3 (@var{z}, @var{vn})
@deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} contour3 (@var{x}, @var{y}, @var{z}, @var{vn})
@deftypefnx {Function File} {} contour3 (@dots{}, @var{style})
@deftypefnx {Function File} {} contour3 (@var{hax}, @dots{})
@deftypefnx {Function File} {[@var{c}, @var{h}] =} contour3 (@dots{})
Create a 3-D contour plot.
@code{contour3} plots level curves (contour lines) of the matrix @var{z}
at a Z level corresponding to each contour. This is in contrast to
@code{contour} which plots all of the contour lines at the same Z level
and produces a 2-D plot.
The level curves are taken from the contour matrix @var{c} computed by
@code{contourc} for the same arguments; see the latter for their
interpretation.
The appearance of contour lines can be defined with a line style @var{style}
in the same manner as @code{plot}. Only line style and color are used;
Any markers defined by @var{style} are ignored.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional output @var{c} are the contour levels in @code{contourc} format.
The optional return value @var{h} is a graphics handle to the hggroup
comprising the contour lines.
Example:
@example
@group
contour3 (peaks (19));
colormap cool;
hold on;
surf (peaks (19), "facecolor", "none", "edgecolor", "black");
@end group
@end example
@seealso{@ref{XREFcontour,,contour}, @ref{XREFcontourc,,contourc}, @ref{XREFcontourf,,contourf}, @ref{XREFclabel,,clabel}, @ref{XREFmeshc,,meshc}, @ref{XREFsurfc,,surfc}, @ref{XREFcaxis,,caxis}, @ref{XREFcolormap,,colormap}, @ref{XREFplot,,plot}}
@end deftypefn
The @code{errorbar}, @code{semilogxerr}, @code{semilogyerr}, and
@code{loglogerr} functions produce plots with error bar markers. For
example,
@example
@group
x = 0:0.1:10;
y = sin (x);
yp = 0.1 .* randn (size (x));
ym = -0.1 .* randn (size (x));
errorbar (x, sin (x), ym, yp);
@end group
@end example
@noindent
produces the figure shown in @ref{fig:errorbar}.
@float Figure,fig:errorbar
@center @image{errorbar,4in}
@caption{Errorbar plot.}
@end float
@c errorbar scripts/plot/draw/errorbar.m
@anchor{XREFerrorbar}
@deftypefn {Function File} {} errorbar (@var{y}, @var{ey})
@deftypefnx {Function File} {} errorbar (@var{y}, @dots{}, @var{fmt})
@deftypefnx {Function File} {} errorbar (@var{x}, @var{y}, @var{ey})
@deftypefnx {Function File} {} errorbar (@var{x}, @var{y}, @var{err}, @var{fmt})
@deftypefnx {Function File} {} errorbar (@var{x}, @var{y}, @var{lerr}, @var{uerr}, @var{fmt})
@deftypefnx {Function File} {} errorbar (@var{x}, @var{y}, @var{ex}, @var{ey}, @var{fmt})
@deftypefnx {Function File} {} errorbar (@var{x}, @var{y}, @var{lx}, @var{ux}, @var{ly}, @var{uy}, @var{fmt})
@deftypefnx {Function File} {} errorbar (@var{x1}, @var{y1}, @dots{}, @var{fmt}, @var{xn}, @var{yn}, @dots{})
@deftypefnx {Function File} {} errorbar (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} errorbar (@dots{})
Create a 2-D plot with errorbars.
Many different combinations of arguments are possible. The simplest form is
@example
errorbar (@var{y}, @var{ey})
@end example
@noindent
where the first argument is taken as the set of @var{y} coordinates, the
second argument @var{ey} are the errors around the @var{y} values, and the
@var{x} coordinates are taken to be the indices of the elements
(@code{1:numel (@var{y})}).
The general form of the function is
@example
errorbar (@var{x}, @var{y}, @var{err1}, @dots{}, @var{fmt}, @dots{})
@end example
@noindent
After the @var{x} and @var{y} arguments there can be 1, 2, or 4
parameters specifying the error values depending on the nature of the error
values and the plot format @var{fmt}.
@table @asis
@item @var{err} (scalar)
When the error is a scalar all points share the same error value.
The errorbars are symmetric and are drawn from @var{data}-@var{err} to
@var{data}+@var{err}.
The @var{fmt} argument determines whether @var{err} is in the x-direction,
y-direction (default), or both.
@item @var{err} (vector or matrix)
Each data point has a particular error value.
The errorbars are symmetric and are drawn from @var{data}(n)-@var{err}(n) to
@var{data}(n)+@var{err}(n).
@item @var{lerr}, @var{uerr} (scalar)
The errors have a single low-side value and a single upper-side value.
The errorbars are not symmetric and are drawn from @var{data}-@var{lerr} to
@var{data}+@var{uerr}.
@item @var{lerr}, @var{uerr} (vector or matrix)
Each data point has a low-side error and an upper-side error.
The errorbars are not symmetric and are drawn from
@var{data}(n)-@var{lerr}(n) to @var{data}(n)+@var{uerr}(n).
@end table
Any number of data sets (@var{x1},@var{y1}, @var{x2},@var{y2}, @dots{}) may
appear as long as they are separated by a format string @var{fmt}.
If @var{y} is a matrix, @var{x} and the error parameters must also be
matrices having the same dimensions. The columns of @var{y} are plotted
versus the corresponding columns of @var{x} and errorbars are taken from
the corresponding columns of the error parameters.
If @var{fmt} is missing, the yerrorbars ("~") plot style is assumed.
If the @var{fmt} argument is supplied then it is interpreted, as in normal
plots, to specify the line style, marker, and color. In addition,
@var{fmt} may include an errorbar style which @strong{must precede} the
ordinary format codes. The following errorbar styles are supported:
@table @samp
@item ~
Set yerrorbars plot style (default).
@item >
Set xerrorbars plot style.
@item ~>
Set xyerrorbars plot style.
@item #~
Set yboxes plot style.
@item #
Set xboxes plot style.
@item #~>
Set xyboxes plot style.
@end table
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a handle to the hggroup object
representing the data plot and errorbars.
Note: For compatibility with @sc{matlab} a line is drawn through all data
points. However, most scientific errorbar plots are a scatter plot of
points with errorbars. To accomplish this, add a marker style to the
@var{fmt} argument such as @qcode{"."}. Alternatively, remove the line
by modifying the returned graphic handle with
@code{set (h, "linestyle", "none")}.
Examples:
@example
errorbar (@var{x}, @var{y}, @var{ex}, ">.r")
@end example
@noindent
produces an xerrorbar plot of @var{y} versus @var{x} with @var{x}
errorbars drawn from @var{x}-@var{ex} to @var{x}+@var{ex}. The marker
@qcode{"."} is used so no connecting line is drawn and the errorbars
appear in red.
@example
@group
errorbar (@var{x}, @var{y1}, @var{ey}, "~",
@var{x}, @var{y2}, @var{ly}, @var{uy})
@end group
@end example
@noindent
produces yerrorbar plots with @var{y1} and @var{y2} versus @var{x}.
Errorbars for @var{y1} are drawn from @var{y1}-@var{ey} to
@var{y1}+@var{ey}, errorbars for @var{y2} from @var{y2}-@var{ly} to
@var{y2}+@var{uy}.
@example
@group
errorbar (@var{x}, @var{y}, @var{lx}, @var{ux},
@var{ly}, @var{uy}, "~>")
@end group
@end example
@noindent
produces an xyerrorbar plot of @var{y} versus @var{x} in which
@var{x} errorbars are drawn from @var{x}-@var{lx} to @var{x}+@var{ux}
and @var{y} errorbars from @var{y}-@var{ly} to @var{y}+@var{uy}.
@seealso{@ref{XREFsemilogxerr,,semilogxerr}, @ref{XREFsemilogyerr,,semilogyerr}, @ref{XREFloglogerr,,loglogerr}, @ref{XREFplot,,plot}}
@end deftypefn
@c semilogxerr scripts/plot/draw/semilogxerr.m
@anchor{XREFsemilogxerr}
@deftypefn {Function File} {} semilogxerr (@var{y}, @var{ey})
@deftypefnx {Function File} {} semilogxerr (@var{y}, @dots{}, @var{fmt})
@deftypefnx {Function File} {} semilogxerr (@var{x}, @var{y}, @var{ey})
@deftypefnx {Function File} {} semilogxerr (@var{x}, @var{y}, @var{err}, @var{fmt})
@deftypefnx {Function File} {} semilogxerr (@var{x}, @var{y}, @var{lerr}, @var{uerr}, @var{fmt})
@deftypefnx {Function File} {} semilogxerr (@var{x}, @var{y}, @var{ex}, @var{ey}, @var{fmt})
@deftypefnx {Function File} {} semilogxerr (@var{x}, @var{y}, @var{lx}, @var{ux}, @var{ly}, @var{uy}, @var{fmt})
@deftypefnx {Function File} {} semilogxerr (@var{x1}, @var{y1}, @dots{}, @var{fmt}, @var{xn}, @var{yn}, @dots{})
@deftypefnx {Function File} {} semilogxerr (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} semilogxerr (@dots{})
Produce 2-D plots using a logarithmic scale for the x-axis and
errorbars at each data point.
Many different combinations of arguments are possible. The most common
form is
@example
semilogxerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
@end example
@noindent
which produces a semi-logarithmic plot of @var{y} versus @var{x}
with errors in the @var{y}-scale defined by @var{ey} and the plot
format defined by @var{fmt}. @xref{XREFerrorbar,,errorbar}, for available
formats and additional information.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
@seealso{@ref{XREFerrorbar,,errorbar}, @ref{XREFsemilogyerr,,semilogyerr}, @ref{XREFloglogerr,,loglogerr}}
@end deftypefn
@c semilogyerr scripts/plot/draw/semilogyerr.m
@anchor{XREFsemilogyerr}
@deftypefn {Function File} {} semilogyerr (@var{y}, @var{ey})
@deftypefnx {Function File} {} semilogyerr (@var{y}, @dots{}, @var{fmt})
@deftypefnx {Function File} {} semilogyerr (@var{x}, @var{y}, @var{ey})
@deftypefnx {Function File} {} semilogyerr (@var{x}, @var{y}, @var{err}, @var{fmt})
@deftypefnx {Function File} {} semilogyerr (@var{x}, @var{y}, @var{lerr}, @var{uerr}, @var{fmt})
@deftypefnx {Function File} {} semilogyerr (@var{x}, @var{y}, @var{ex}, @var{ey}, @var{fmt})
@deftypefnx {Function File} {} semilogyerr (@var{x}, @var{y}, @var{lx}, @var{ux}, @var{ly}, @var{uy}, @var{fmt})
@deftypefnx {Function File} {} semilogyerr (@var{x1}, @var{y1}, @dots{}, @var{fmt}, @var{xn}, @var{yn}, @dots{})
@deftypefnx {Function File} {} semilogyerr (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} semilogyerr (@dots{})
Produce 2-D plots using a logarithmic scale for the y-axis and
errorbars at each data point.
Many different combinations of arguments are possible. The most common
form is
@example
semilogyerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
@end example
@noindent
which produces a semi-logarithmic plot of @var{y} versus @var{x}
with errors in the @var{y}-scale defined by @var{ey} and the plot
format defined by @var{fmt}. @xref{XREFerrorbar,,errorbar}, for available
formats and additional information.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
@seealso{@ref{XREFerrorbar,,errorbar}, @ref{XREFsemilogxerr,,semilogxerr}, @ref{XREFloglogerr,,loglogerr}}
@end deftypefn
@c loglogerr scripts/plot/draw/loglogerr.m
@anchor{XREFloglogerr}
@deftypefn {Function File} {} loglogerr (@var{y}, @var{ey})
@deftypefnx {Function File} {} loglogerr (@var{y}, @dots{}, @var{fmt})
@deftypefnx {Function File} {} loglogerr (@var{x}, @var{y}, @var{ey})
@deftypefnx {Function File} {} loglogerr (@var{x}, @var{y}, @var{err}, @var{fmt})
@deftypefnx {Function File} {} loglogerr (@var{x}, @var{y}, @var{lerr}, @var{uerr}, @var{fmt})
@deftypefnx {Function File} {} loglogerr (@var{x}, @var{y}, @var{ex}, @var{ey}, @var{fmt})
@deftypefnx {Function File} {} loglogerr (@var{x}, @var{y}, @var{lx}, @var{ux}, @var{ly}, @var{uy}, @var{fmt})
@deftypefnx {Function File} {} loglogerr (@var{x1}, @var{y1}, @dots{}, @var{fmt}, @var{xn}, @var{yn}, @dots{})
@deftypefnx {Function File} {} loglogerr (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} loglogerr (@dots{})
Produce 2-D plots on a double logarithm axis with errorbars.
Many different combinations of arguments are possible. The most common
form is
@example
loglogerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
@end example
@noindent
which produces a double logarithm plot of @var{y} versus @var{x}
with errors in the @var{y}-scale defined by @var{ey} and the plot
format defined by @var{fmt}. @xref{XREFerrorbar,,errorbar}, for available
formats and additional information.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
@seealso{@ref{XREFerrorbar,,errorbar}, @ref{XREFsemilogxerr,,semilogxerr}, @ref{XREFsemilogyerr,,semilogyerr}}
@end deftypefn
Finally, the @code{polar} function allows you to easily plot data in
polar coordinates. However, the display coordinates remain rectangular
and linear. For example,
@example
polar (0:0.1:10*pi, 0:0.1:10*pi);
@end example
@noindent
produces the spiral plot shown in @ref{fig:polar}.
@float Figure,fig:polar
@center @image{polar,4in}
@caption{Polar plot.}
@end float
@c polar scripts/plot/draw/polar.m
@anchor{XREFpolar}
@deftypefn {Function File} {} polar (@var{theta}, @var{rho})
@deftypefnx {Function File} {} polar (@var{theta}, @var{rho}, @var{fmt})
@deftypefnx {Function File} {} polar (@var{cplx})
@deftypefnx {Function File} {} polar (@var{cplx}, @var{fmt})
@deftypefnx {Function File} {} polar (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} polar (@dots{})
Create a 2-D plot from polar coordinates @var{theta} and @var{rho}.
If a single complex input @var{cplx} is given then the real part is used
for @var{theta} and the imaginary part is used for @var{rho}.
The optional argument @var{fmt} specifies the line format in the same way
as @code{plot}.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created plot.
@seealso{@ref{XREFrose,,rose}, @ref{XREFcompass,,compass}, @ref{XREFplot,,plot}}
@end deftypefn
@c pie scripts/plot/draw/pie.m
@anchor{XREFpie}
@deftypefn {Function File} {} pie (@var{x})
@deftypefnx {Function File} {} pie (@dots{}, @var{explode})
@deftypefnx {Function File} {} pie (@dots{}, @var{labels})
@deftypefnx {Function File} {} pie (@var{hax}, @dots{});
@deftypefnx {Function File} {@var{h} =} pie (@dots{});
Plot a 2-D pie chart.
When called with a single vector argument, produce a pie chart of the
elements in @var{x}. The size of the ith slice is the percentage that the
element @var{x}i represents of the total sum of @var{x}:
@code{pct = @var{x}(i) / sum (@var{x})}.
The optional input @var{explode} is a vector of the same length as @var{x}
that, if non-zero, "explodes" the slice from the pie chart.
The optional input @var{labels} is a cell array of strings of the same
length as @var{x} specifying the label for each slice.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a list of handles to the patch
and text objects generating the plot.
Note: If @code{sum (@var{x}) @leq{} 1} then the elements of @var{x} are
interpreted as percentages directly and are not normalized by @code{sum (x)}.
Furthermore, if the sum is less than 1 then there will be a missing slice
in the pie plot to represent the missing, unspecified percentage.
@seealso{@ref{XREFpie3,,pie3}, @ref{XREFbar,,bar}, @ref{XREFhist,,hist}, @ref{XREFrose,,rose}}
@end deftypefn
@c pie3 scripts/plot/draw/pie3.m
@anchor{XREFpie3}
@deftypefn {Function File} {} pie3 (@var{x})
@deftypefnx {Function File} {} pie3 (@dots{}, @var{explode})
@deftypefnx {Function File} {} pie3 (@dots{}, @var{labels})
@deftypefnx {Function File} {} pie3 (@var{hax}, @dots{});
@deftypefnx {Function File} {@var{h} =} pie3 (@dots{});
Plot a 3-D pie chart.
Called with a single vector argument, produces a 3-D pie chart of the
elements in @var{x}. The size of the ith slice is the percentage that the
element @var{x}i represents of the total sum of @var{x}:
@code{pct = @var{x}(i) / sum (@var{x})}.
The optional input @var{explode} is a vector of the same length as @var{x}
that, if non-zero, "explodes" the slice from the pie chart.
The optional input @var{labels} is a cell array of strings of the same
length as @var{x} specifying the label for each slice.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a list of graphics handles to the
patch, surface, and text objects generating the plot.
Note: If @code{sum (@var{x}) @leq{} 1} then the elements of @var{x} are
interpreted as percentages directly and are not normalized by @code{sum (x)}.
Furthermore, if the sum is less than 1 then there will be a missing slice
in the pie plot to represent the missing, unspecified percentage.
@seealso{@ref{XREFpie,,pie}, @ref{XREFbar,,bar}, @ref{XREFhist,,hist}, @ref{XREFrose,,rose}}
@end deftypefn
@c quiver scripts/plot/draw/quiver.m
@anchor{XREFquiver}
@deftypefn {Function File} {} quiver (@var{u}, @var{v})
@deftypefnx {Function File} {} quiver (@var{x}, @var{y}, @var{u}, @var{v})
@deftypefnx {Function File} {} quiver (@dots{}, @var{s})
@deftypefnx {Function File} {} quiver (@dots{}, @var{style})
@deftypefnx {Function File} {} quiver (@dots{}, "filled")
@deftypefnx {Function File} {} quiver (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} quiver (@dots{})
Plot the (@var{u}, @var{v}) components of a vector field in
an (@var{x}, @var{y}) meshgrid. If the grid is uniform, you can
specify @var{x} and @var{y} as vectors.
If @var{x} and @var{y} are undefined they are assumed to be
@code{(1:@var{m}, 1:@var{n})} where
@code{[@var{m}, @var{n}] = size (@var{u})}.
The variable @var{s} is a scalar defining a scaling factor to use for
the arrows of the field relative to the mesh spacing. A value of 0
disables all scaling. The default value is 0.9.
The style to use for the plot can be defined with a line style @var{style}
of the same format as the @code{plot} command.
If a marker is specified then markers at the grid points of the vectors are
drawn rather than arrows. If the argument @qcode{"filled"} is given then
the markers are filled.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to a quiver object.
A quiver object regroups the components of the quiver plot (body, arrow,
and marker), and allows them to be changed together.
Example:
@example
@group
[x, y] = meshgrid (1:2:20);
h = quiver (x, y, sin (2*pi*x/10), sin (2*pi*y/10));
set (h, "maxheadsize", 0.33);
@end group
@end example
@seealso{@ref{XREFquiver3,,quiver3}, @ref{XREFcompass,,compass}, @ref{XREFfeather,,feather}, @ref{XREFplot,,plot}}
@end deftypefn
@c quiver3 scripts/plot/draw/quiver3.m
@anchor{XREFquiver3}
@deftypefn {Function File} {} quiver3 (@var{u}, @var{v}, @var{w})
@deftypefnx {Function File} {} quiver3 (@var{x}, @var{y}, @var{z}, @var{u}, @var{v}, @var{w})
@deftypefnx {Function File} {} quiver3 (@dots{}, @var{s})
@deftypefnx {Function File} {} quiver3 (@dots{}, @var{style})
@deftypefnx {Function File} {} quiver3 (@dots{}, "filled")
@deftypefnx {Function File} {} quiver3 (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} quiver3 (@dots{})
Plot the (@var{u}, @var{v}, @var{w}) components of a vector field in
an (@var{x}, @var{y}, @var{z}) meshgrid. If the grid is uniform, you
can specify @var{x}, @var{y}, and @var{z} as vectors.
If @var{x}, @var{y}, and @var{z} are undefined they are assumed to be
@code{(1:@var{m}, 1:@var{n}, 1:@var{p})} where @code{[@var{m}, @var{n}] =
size (@var{u})} and @code{@var{p} = max (size (@var{w}))}.
The variable @var{s} is a scalar defining a scaling factor to use for
the arrows of the field relative to the mesh spacing. A value of 0
disables all scaling. The default value is 0.9.
The style to use for the plot can be defined with a line style @var{style}
of the same format as the @code{plot} command.
If a marker is specified then markers at the grid points of the vectors are
drawn rather than arrows. If the argument @qcode{"filled"} is given then the
markers are filled.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to a quiver object.
A quiver object regroups the components of the quiver plot (body, arrow,
and marker), and allows them to be changed together.
@example
@group
[x, y, z] = peaks (25);
surf (x, y, z);
hold on;
[u, v, w] = surfnorm (x, y, z / 10);
h = quiver3 (x, y, z, u, v, w);
set (h, "maxheadsize", 0.33);
@end group
@end example
@seealso{@ref{XREFquiver,,quiver}, @ref{XREFcompass,,compass}, @ref{XREFfeather,,feather}, @ref{XREFplot,,plot}}
@end deftypefn
@c compass scripts/plot/draw/compass.m
@anchor{XREFcompass}
@deftypefn {Function File} {} compass (@var{u}, @var{v})
@deftypefnx {Function File} {} compass (@var{z})
@deftypefnx {Function File} {} compass (@dots{}, @var{style})
@deftypefnx {Function File} {} compass (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} compass (@dots{})
Plot the @code{(@var{u}, @var{v})} components of a vector field emanating
from the origin of a polar plot.
The arrow representing each vector has one end at the origin and the tip at
[@var{u}(i), @var{v}(i)]. If a single complex argument @var{z} is given,
then @code{@var{u} = real (@var{z})} and @code{@var{v} = imag (@var{z})}.
The style to use for the plot can be defined with a line style @var{style}
of the same format as the @code{plot} command.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a vector of graphics handles to the
line objects representing the drawn vectors.
@example
@group
a = toeplitz ([1;randn(9,1)], [1,randn(1,9)]);
compass (eig (a));
@end group
@end example
@seealso{@ref{XREFpolar,,polar}, @ref{XREFfeather,,feather}, @ref{XREFquiver,,quiver}, @ref{XREFrose,,rose}, @ref{XREFplot,,plot}}
@end deftypefn
@c feather scripts/plot/draw/feather.m
@anchor{XREFfeather}
@deftypefn {Function File} {} feather (@var{u}, @var{v})
@deftypefnx {Function File} {} feather (@var{z})
@deftypefnx {Function File} {} feather (@dots{}, @var{style})
@deftypefnx {Function File} {} feather (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} feather (@dots{})
Plot the @code{(@var{u}, @var{v})} components of a vector field emanating
from equidistant points on the x-axis.
If a single complex argument @var{z} is given, then
@code{@var{u} = real (@var{z})} and @code{@var{v} = imag (@var{z})}.
The style to use for the plot can be defined with a line style @var{style}
of the same format as the @code{plot} command.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a vector of graphics handles to the
line objects representing the drawn vectors.
@example
@group
phi = [0 : 15 : 360] * pi/180;
feather (sin (phi), cos (phi));
@end group
@end example
@seealso{@ref{XREFplot,,plot}, @ref{XREFquiver,,quiver}, @ref{XREFcompass,,compass}}
@end deftypefn
@c pcolor scripts/plot/draw/pcolor.m
@anchor{XREFpcolor}
@deftypefn {Function File} {} pcolor (@var{x}, @var{y}, @var{c})
@deftypefnx {Function File} {} pcolor (@var{c})
@deftypefnx {Function File} {} pcolor (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} pcolor (@dots{})
Produce a 2-D density plot.
A @code{pcolor} plot draws rectangles with colors from the matrix @var{c}
over the two-dimensional region represented by the matrices @var{x} and
@var{y}. @var{x} and @var{y} are the coordinates of the mesh's vertices
and are typically the output of @code{meshgrid}. If @var{x} and @var{y} are
vectors, then a typical vertex is (@var{x}(j), @var{y}(i), @var{c}(i,j)).
Thus, columns of @var{c} correspond to different @var{x} values and rows
of @var{c} correspond to different @var{y} values.
The values in @var{c} are scaled to span the range of the current
colormap. Limits may be placed on the color axis by the command
@code{caxis}, or by setting the @code{clim} property of the parent axis.
The face color of each cell of the mesh is determined by interpolating
the values of @var{c} for each of the cell's vertices; Contrast this with
@code{imagesc} which renders one cell for each element of @var{c}.
@code{shading} modifies an attribute determining the manner by which the
face color of each cell is interpolated from the values of @var{c},
and the visibility of the cells' edges. By default the attribute is
@qcode{"faceted"}, which renders a single color for each cell's face with
the edge visible.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
surface object.
@seealso{@ref{XREFcaxis,,caxis}, @ref{XREFshading,,shading}, @ref{XREFmeshgrid,,meshgrid}, @ref{XREFcontour,,contour}, @ref{XREFimagesc,,imagesc}}
@end deftypefn
@c area scripts/plot/draw/area.m
@anchor{XREFarea}
@deftypefn {Function File} {} area (@var{y})
@deftypefnx {Function File} {} area (@var{x}, @var{y})
@deftypefnx {Function File} {} area (@dots{}, @var{lvl})
@deftypefnx {Function File} {} area (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} area (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} area (@dots{})
Area plot of the columns of @var{y}.
This plot shows the contributions of each column value to the row sum. It
is functionally similar to @code{plot (@var{x}, cumsum (@var{y}, 2))},
except that the area under the curve is shaded.
If the @var{x} argument is omitted it defaults to @code{1:rows (@var{y})}.
A value @var{lvl} can be defined that determines where the base level of
the shading under the curve should be defined. The default level is 0.
Additional property/value pairs are passed directly to the underlying patch
object.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the hggroup
object comprising the area patch objects. The @qcode{"BaseValue"} property
of the hggroup can be used to adjust the level where shading begins.
Example: Verify identity sin^2 + cos^2 = 1
@example
@group
t = linspace (0, 2*pi, 100)';
y = [sin(t).^2, cos(t).^2)];
area (t, y);
legend ("sin^2", "cos^2", "location", "NorthEastOutside");
@end group
@end example
@seealso{@ref{XREFplot,,plot}, @ref{XREFpatch,,patch}}
@end deftypefn
@c comet scripts/plot/draw/comet.m
@anchor{XREFcomet}
@deftypefn {Function File} {} comet (@var{y})
@deftypefnx {Function File} {} comet (@var{x}, @var{y})
@deftypefnx {Function File} {} comet (@var{x}, @var{y}, @var{p})
@deftypefnx {Function File} {} comet (@var{hax}, @dots{})
Produce a simple comet style animation along the trajectory provided by
the input coordinate vectors (@var{x}, @var{y}). If @var{x} is not
specified it defaults to the indices of @var{y}.
The speed of the comet may be controlled by @var{p}, which represents the
time each point is displayed before moving to the next one. The default for
@var{p} is 0.1 seconds.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
@seealso{@ref{XREFcomet3,,comet3}}
@end deftypefn
@c comet3 scripts/plot/draw/comet3.m
@anchor{XREFcomet3}
@deftypefn {Function File} {} comet3 (@var{z})
@deftypefnx {Function File} {} comet3 (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} comet3 (@var{x}, @var{y}, @var{z}, @var{p})
@deftypefnx {Function File} {} comet3 (@var{hax}, @dots{})
Produce a simple comet style animation along the trajectory provided by
the input coordinate vectors (@var{x}, @var{y}, @var{z}). If only @var{z}
is specified then @var{x}, @var{y} default to the indices of @var{z}.
The speed of the comet may be controlled by @var{p}, which represents the
time each point is displayed before moving to the next one. The default for
@var{p} is 0.1 seconds.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
@seealso{@ref{XREFcomet,,comet}}
@end deftypefn
@node Axis Configuration
@subsubsection Axis Configuration
The axis function may be used to change the axis limits of an existing
plot and various other axis properties, such as the aspect ratio and the
appearance of tic marks.
@c axis scripts/plot/appearance/axis.m
@anchor{XREFaxis}
@deftypefn {Function File} {} axis ()
@deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi])
@deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi @var{y}_lo @var{y}_hi])
@deftypefnx {Function File} {} axis ([@var{x}_lo @var{x}_hi @var{y}_lo @var{y}_hi @var{z}_lo @var{z}_hi])
@deftypefnx {Function File} {} axis (@var{option})
@deftypefnx {Function File} {} axis (@dots{}, @var{option})
@deftypefnx {Function File} {} axis (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{limits} =} axis ()
Set axis limits and appearance.
The argument @var{limits} should be a 2-, 4-, or 6-element vector. The
first and second elements specify the lower and upper limits for the
x-axis. The third and fourth specify the limits for the y-axis, and the
fifth and sixth specify the limits for the z-axis.
Without any arguments, @code{axis} turns autoscaling on.
With one output argument, @code{@var{limits} = axis} returns the current
axis limits.
The vector argument specifying limits is optional, and additional
string arguments may be used to specify various axis properties. For
example,
@example
axis ([1, 2, 3, 4], "square");
@end example
@noindent
forces a square aspect ratio, and
@example
axis ("tic", "labely");
@end example
@noindent
turns tic marks on for all axes and tic mark labels on for the y-axis
only.
@noindent
The following options control the aspect ratio of the axes.
@table @asis
@item @qcode{"square"}
Force a square aspect ratio.
@item @qcode{"equal"}
Force x distance to equal y-distance.
@item @qcode{"normal"}
Restore default aspect ratio.
@end table
@noindent
The following options control the way axis limits are interpreted.
@table @asis
@item @qcode{"auto"}
Set the specified axes to have nice limits around the data
or all if no axes are specified.
@item @qcode{"manual"}
Fix the current axes limits.
@item @qcode{"tight"}
Fix axes to the limits of the data.
@item @qcode{"image"}
Equivalent to @qcode{"tight"} and @qcode{"equal"}.
@end table
@noindent
The following options affect the appearance of tic marks.
@table @asis
@item @qcode{"on"}
Turn tic marks and labels on for all axes.
@item @qcode{"off"}
Turn tic marks off for all axes.
@item @qcode{"tic[xyz]"}
Turn tic marks on for all axes, or turn them on for the
specified axes and off for the remainder.
@item @qcode{"label[xyz]"}
Turn tic labels on for all axes, or turn them on for the
specified axes and off for the remainder.
@item @qcode{"nolabel"}
Turn tic labels off for all axes.
@end table
Note, if there are no tic marks for an axis, there can be no labels.
@noindent
The following options affect the direction of increasing values on the axes.
@table @asis
@item @qcode{"ij"}
Reverse y-axis, so lower values are nearer the top.
@item @qcode{"xy"}
Restore y-axis, so higher values are nearer the top.
@end table
If the first argument @var{hax} is an axes handle, then operate on
this axes rather than the current axes returned by @code{gca}.
@seealso{@ref{XREFxlim,,xlim}, @ref{XREFylim,,ylim}, @ref{XREFzlim,,zlim}, @ref{XREFdaspect,,daspect}, @ref{XREFpbaspect,,pbaspect}, @ref{XREFbox,,box}, @ref{XREFgrid,,grid}}
@end deftypefn
Similarly the axis limits of the colormap can be changed with the caxis
function.
@c caxis scripts/plot/appearance/caxis.m
@anchor{XREFcaxis}
@deftypefn {Function File} {} caxis ([cmin cmax])
@deftypefnx {Function File} {} caxis ("auto")
@deftypefnx {Function File} {} caxis ("manual")
@deftypefnx {Function File} {} caxis (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{limits} =} caxis ()
Query or set color axis limits for plots.
The limits argument should be a 2-element vector specifying the
lower and upper limits to assign to the first and last value in the
colormap. Data values outside this range are clamped to the first and last
colormap entries.
If the @qcode{"auto"} option is given then automatic colormap limits are
applied. The automatic algorithm sets @var{cmin} to the minimum data value
and @var{cmax} to the maximum data value. If @qcode{"manual"} is specified
then the @qcode{"climmode"} property is set to @qcode{"manual"} and the
numeric values in the @qcode{"clim"} property are used for limits.
If the first argument @var{hax} is an axes handle, then operate on
this axis rather than the current axes returned by @code{gca}.
Called without arguments the current color axis limits are returned.
@seealso{@ref{XREFcolormap,,colormap}}
@end deftypefn
The @code{xlim}, @code{ylim}, and @code{zlim} functions may be used to
get or set individual axis limits. Each has the same form.
@c Add cross-references and function index entries for other limit functions.
@anchor{XREFylim}
@anchor{XREFzlim}
@findex ylim
@findex zlim
@c xlim scripts/plot/appearance/xlim.m
@anchor{XREFxlim}
@deftypefn {Function File} {@var{xlimits} =} xlim ()
@deftypefnx {Function File} {@var{xmode} =} xlim ("mode")
@deftypefnx {Function File} {} xlim ([@var{x_lo} @var{x_hi}])
@deftypefnx {Function File} {} xlim ("auto")
@deftypefnx {Function File} {} xlim ("manual")
@deftypefnx {Function File} {} xlim (@var{hax}, @dots{})
Query or set the limits of the x-axis for the current plot.
Called without arguments @code{xlim} returns the x-axis limits of the
current plot. With the input query @qcode{"mode"}, return the current
x-limit calculation mode which is either @qcode{"auto"} or @qcode{"manual"}.
If passed a 2-element vector [@var{x_lo} @var{x_hi}], the limits of the
x-axis are set to these values and the mode is set to @qcode{"manual"}.
The current plotting mode can be changed by using either @qcode{"auto"}
or @qcode{"manual"} as the argument.
If the first argument @var{hax} is an axes handle, then operate on
this axis rather than the current axes returned by @code{gca}.
@seealso{@ref{XREFylim,,ylim}, @ref{XREFzlim,,zlim}, @ref{XREFaxis,,axis}, @ref{XREFset,,set}, @ref{XREFget,,get}, @ref{XREFgca,,gca}}
@end deftypefn
@node Two-dimensional Function Plotting
@subsubsection Two-dimensional Function Plotting
@cindex plotting, two-dimensional functions
Octave can plot a function from a function handle, inline function, or
string defining the function without the user needing to explicitly
create the data to be plotted. The function @code{fplot} also generates
two-dimensional plots with linear axes using a function name and limits
for the range of the x-coordinate instead of the x and y data. For
example,
@example
@group
fplot (@@sin, [-10, 10], 201);
@end group
@end example
@noindent
produces a plot that is equivalent to the one above, but also includes a
legend displaying the name of the plotted function.
@c fplot scripts/plot/draw/fplot.m
@anchor{XREFfplot}
@deftypefn {Function File} {} fplot (@var{fn}, @var{limits})
@deftypefnx {Function File} {} fplot (@dots{}, @var{tol})
@deftypefnx {Function File} {} fplot (@dots{}, @var{n})
@deftypefnx {Function File} {} fplot (@dots{}, @var{fmt})
@deftypefnx {Function File} {[@var{x}, @var{y}] =} fplot (@dots{})
Plot a function @var{fn} within the range defined by @var{limits}.
@var{fn} is a function handle, inline function, or string containing the
name of the function to evaluate.
The limits of the plot are of the form @w{@code{[@var{xlo}, @var{xhi}]}} or
@w{@code{[@var{xlo}, @var{xhi}, @var{ylo}, @var{yhi}]}}.
The next three arguments are all optional and any number of them may be
given in any order.
@var{tol} is the relative tolerance to use for the plot and defaults
to 2e-3 (.2%).
@var{n} is the minimum number of points to use. When @var{n} is specified,
the maximum stepsize will be @code{@var{xhi} - @var{xlo} / @var{n}}. More
than @var{n} points may still be used in order to meet the relative
tolerance requirement.
The @var{fmt} argument specifies the linestyle to be used by the plot
command.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
With no output arguments the results are immediately plotted. With two
output arguments the 2-D plot data is returned. The data can subsequently
be plotted manually with @code{plot (@var{x}, @var{y})}.
Example:
@example
@group
fplot (@@cos, [0, 2*pi])
fplot ("[cos(x), sin(x)]", [0, 2*pi])
@end group
@end example
Note: @code{fplot} works best with continuous functions. Functions with
discontinuities are unlikely to plot well. This restriction may be removed
in the future.
@seealso{@ref{XREFezplot,,ezplot}, @ref{XREFplot,,plot}}
@end deftypefn
Other functions that can create two-dimensional plots directly from a
function include @code{ezplot}, @code{ezcontour}, @code{ezcontourf} and
@code{ezpolar}.
@c ezplot scripts/plot/draw/ezplot.m
@anchor{XREFezplot}
@deftypefn {Function File} {} ezplot (@var{f})
@deftypefnx {Function File} {} ezplot (@var{f2v})
@deftypefnx {Function File} {} ezplot (@var{fx}, @var{fy})
@deftypefnx {Function File} {} ezplot (@dots{}, @var{dom})
@deftypefnx {Function File} {} ezplot (@dots{}, @var{n})
@deftypefnx {Function File} {} ezplot (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} ezplot (@dots{})
Plot the 2-D curve defined by the function @var{f}.
The function @var{f} may be a string, inline function, or function handle
and can have either one or two variables. If @var{f} has one variable, then
the function is plotted over the domain @code{-2*pi < @var{x} < 2*pi}
with 500 points.
If @var{f2v} is a function of two variables then the implicit function
@code{@var{f}(@var{x},@var{y}) = 0} is calculated over the meshed domain
@code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
For example:
@example
ezplot (@@(@var{x}, @var{y}) @var{x}.^2 - @var{y}.^2 - 1)
@end example
If two functions are passed as inputs then the parametric function
@example
@group
@var{x} = @var{fx} (@var{t})
@var{y} = @var{fy} (@var{t})
@end group
@end example
@noindent
is plotted over the domain @code{-2*pi <= @var{t} <= 2*pi} with 500 points.
If @var{dom} is a two element vector, it represents the minimum and maximum
values of both @var{x} and @var{y}, or @var{t} for a parametric plot. If
@var{dom} is a four element vector, then the minimum and maximum values are
@code{[xmin xmax ymin ymax]}.
@var{n} is a scalar defining the number of points to use in plotting
the function.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a vector of graphics handles to
the created line objects.
@seealso{@ref{XREFplot,,plot}, @ref{XREFezplot3,,ezplot3}, @ref{XREFezpolar,,ezpolar}, @ref{XREFezcontour,,ezcontour}, @ref{XREFezcontourf,,ezcontourf}, @ref{XREFezmesh,,ezmesh}, @ref{XREFezmeshc,,ezmeshc}, @ref{XREFezsurf,,ezsurf}, @ref{XREFezsurfc,,ezsurfc}}
@end deftypefn
@c ezcontour scripts/plot/draw/ezcontour.m
@anchor{XREFezcontour}
@deftypefn {Function File} {} ezcontour (@var{f})
@deftypefnx {Function File} {} ezcontour (@dots{}, @var{dom})
@deftypefnx {Function File} {} ezcontour (@dots{}, @var{n})
@deftypefnx {Function File} {} ezcontour (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} ezcontour (@dots{})
Plot the contour lines of a function.
@var{f} is a string, inline function, or function handle with two arguments
defining the function. By default the plot is over the meshed domain
@code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
If @var{dom} is a two element vector, it represents the minimum and maximum
values of both @var{x} and @var{y}. If @var{dom} is a four element vector,
then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
@var{n} is a scalar defining the number of points to use in each dimension.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created plot.
Example:
@example
@group
f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
ezcontour (f, [-3, 3]);
@end group
@end example
@seealso{@ref{XREFcontour,,contour}, @ref{XREFezcontourf,,ezcontourf}, @ref{XREFezplot,,ezplot}, @ref{XREFezmeshc,,ezmeshc}, @ref{XREFezsurfc,,ezsurfc}}
@end deftypefn
@c ezcontourf scripts/plot/draw/ezcontourf.m
@anchor{XREFezcontourf}
@deftypefn {Function File} {} ezcontourf (@var{f})
@deftypefnx {Function File} {} ezcontourf (@dots{}, @var{dom})
@deftypefnx {Function File} {} ezcontourf (@dots{}, @var{n})
@deftypefnx {Function File} {} ezcontourf (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} ezcontourf (@dots{})
Plot the filled contour lines of a function.
@var{f} is a string, inline function, or function handle with two arguments
defining the function. By default the plot is over the meshed domain
@code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
If @var{dom} is a two element vector, it represents the minimum and maximum
values of both @var{x} and @var{y}. If @var{dom} is a four element vector,
then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
@var{n} is a scalar defining the number of points to use in each dimension.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created plot.
Example:
@example
@group
f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
ezcontourf (f, [-3, 3]);
@end group
@end example
@seealso{@ref{XREFcontourf,,contourf}, @ref{XREFezcontour,,ezcontour}, @ref{XREFezplot,,ezplot}, @ref{XREFezmeshc,,ezmeshc}, @ref{XREFezsurfc,,ezsurfc}}
@end deftypefn
@c ezpolar scripts/plot/draw/ezpolar.m
@anchor{XREFezpolar}
@deftypefn {Function File} {} ezpolar (@var{f})
@deftypefnx {Function File} {} ezpolar (@dots{}, @var{dom})
@deftypefnx {Function File} {} ezpolar (@dots{}, @var{n})
@deftypefnx {Function File} {} ezpolar (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} ezpolar (@dots{})
Plot a 2-D function in polar coordinates.
The function @var{f} is a string, inline function, or function handle with
a single argument. The expected form of the function is
@code{@var{rho} = @var{f}(@var{theta})}.
By default the plot is over the domain @code{0 <= @var{theta} <= 2*pi}
with 500 points.
If @var{dom} is a two element vector, it represents the minimum and maximum
values of @var{theta}.
@var{n} is a scalar defining the number of points to use in plotting
the function.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created plot.
Example:
@example
ezpolar (@@(t) sin (5/4 * t), [0, 8*pi]);
@end example
@seealso{@ref{XREFpolar,,polar}, @ref{XREFezplot,,ezplot}}
@end deftypefn
@node Two-dimensional Geometric Shapes
@subsubsection Two-dimensional Geometric Shapes
@c rectangle scripts/plot/draw/rectangle.m
@anchor{XREFrectangle}
@deftypefn {Function File} {} rectangle ()
@deftypefnx {Function File} {} rectangle (@dots{}, "Position", @var{pos})
@deftypefnx {Function File} {} rectangle (@dots{}, "Curvature", @var{curv})
@deftypefnx {Function File} {} rectangle (@dots{}, "EdgeColor", @var{ec})
@deftypefnx {Function File} {} rectangle (@dots{}, "FaceColor", @var{fc})
@deftypefnx {Function File} {} rectangle (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} rectangle (@dots{})
Draw a rectangular patch defined by @var{pos} and @var{curv}.
The variable @code{@var{pos}(1:2)} defines the lower left-hand corner of
the patch and @code{@var{pos}(3:4)} defines its width and height. By
default, the value of @var{pos} is @code{[0, 0, 1, 1]}.
The variable @var{curv} defines the curvature of the sides of the rectangle
and may be a scalar or two-element vector with values between 0 and 1.
A value of 0 represents no curvature of the side, whereas a value of 1
means that the side is entirely curved into the arc of a circle.
If @var{curv} is a two-element vector, then the first element is the
curvature along the x-axis of the patch and the second along y-axis.
If @var{curv} is a scalar, it represents the curvature of the shorter of the
two sides of the rectangle and the curvature of the other side is defined
by
@example
min (pos(1:2)) / max (pos(1:2)) * curv
@end example
Additional property/value pairs are passed to the underlying patch command.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
rectangle object.
@end deftypefn
@seealso{@ref{XREFpatch,,patch}, @ref{XREFline,,line}, @ref{XREFcylinder,,cylinder}, @ref{XREFellipsoid,,ellipsoid}, @ref{XREFsphere,,sphere}}
@node Three-Dimensional Plots
@subsection Three-Dimensional Plots
@cindex plotting, three-dimensional
The function @code{mesh} produces mesh surface plots. For example,
@example
@group
tx = ty = linspace (-8, 8, 41)';
[xx, yy] = meshgrid (tx, ty);
r = sqrt (xx .^ 2 + yy .^ 2) + eps;
tz = sin (r) ./ r;
mesh (tx, ty, tz);
@end group
@end example
@noindent
produces the familiar ``sombrero'' plot shown in @ref{fig:mesh}. Note
the use of the function @code{meshgrid} to create matrices of X and Y
coordinates to use for plotting the Z data. The @code{ndgrid} function
is similar to @code{meshgrid}, but works for N-dimensional matrices.
@float Figure,fig:mesh
@center @image{mesh,4in}
@caption{Mesh plot.}
@end float
The @code{meshc} function is similar to @code{mesh}, but also produces a
plot of contours for the surface.
The @code{plot3} function displays arbitrary three-dimensional data,
without requiring it to form a surface. For example,
@example
@group
t = 0:0.1:10*pi;
r = linspace (0, 1, numel (t));
z = linspace (0, 1, numel (t));
plot3 (r.*sin(t), r.*cos(t), z);
@end group
@end example
@noindent
displays the spiral in three dimensions shown in @ref{fig:plot3}.
@float Figure,fig:plot3
@center @image{plot3,4in}
@caption{Three-dimensional spiral.}
@end float
Finally, the @code{view} function changes the viewpoint for
three-dimensional plots.
@c mesh scripts/plot/draw/mesh.m
@anchor{XREFmesh}
@deftypefn {Function File} {} mesh (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} mesh (@var{z})
@deftypefnx {Function File} {} mesh (@dots{}, @var{c})
@deftypefnx {Function File} {} mesh (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} mesh (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} mesh (@dots{})
Plot a 3-D wireframe mesh.
The wireframe mesh is plotted using rectangles. The vertices of the
rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
over a 2-D rectangular region in the x-y plane. @var{z} determines the
height above the plane of each vertex. If only a single @var{z} matrix is
given, then it is plotted over the meshgrid
@code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
Thus, columns of @var{z} correspond to different @var{x} values and rows
of @var{z} correspond to different @var{y} values.
The color of the mesh is computed by linearly scaling the @var{z} values
to fit the range of the current colormap. Use @code{caxis} and/or
change the colormap to control the appearance.
Optionally, the color of the mesh can be specified independently of @var{z}
by supplying a color matrix, @var{c}.
Any property/value pairs are passed directly to the underlying surface
object.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
surface object.
@seealso{@ref{XREFezmesh,,ezmesh}, @ref{XREFmeshc,,meshc}, @ref{XREFmeshz,,meshz}, @ref{XREFtrimesh,,trimesh}, @ref{XREFcontour,,contour}, @ref{XREFsurf,,surf}, @ref{XREFsurface,,surface}, @ref{XREFmeshgrid,,meshgrid}, @ref{XREFhidden,,hidden}, @ref{XREFshading,,shading}, @ref{XREFcolormap,,colormap}, @ref{XREFcaxis,,caxis}}
@end deftypefn
@c meshc scripts/plot/draw/meshc.m
@anchor{XREFmeshc}
@deftypefn {Function File} {} meshc (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} meshc (@var{z})
@deftypefnx {Function File} {} meshc (@dots{}, @var{c})
@deftypefnx {Function File} {} meshc (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} meshc (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} meshc (@dots{})
Plot a 3-D wireframe mesh with underlying contour lines.
The wireframe mesh is plotted using rectangles. The vertices of the
rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
over a 2-D rectangular region in the x-y plane. @var{z} determines the
height above the plane of each vertex. If only a single @var{z} matrix is
given, then it is plotted over the meshgrid
@code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
Thus, columns of @var{z} correspond to different @var{x} values and rows
of @var{z} correspond to different @var{y} values.
The color of the mesh is computed by linearly scaling the @var{z} values
to fit the range of the current colormap. Use @code{caxis} and/or
change the colormap to control the appearance.
Optionally the color of the mesh can be specified independently of @var{z}
by supplying a color matrix, @var{c}.
Any property/value pairs are passed directly to the underlying surface
object.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a 2-element vector with a graphics
handle to the created surface object and to the created contour plot.
@seealso{@ref{XREFezmeshc,,ezmeshc}, @ref{XREFmesh,,mesh}, @ref{XREFmeshz,,meshz}, @ref{XREFcontour,,contour}, @ref{XREFsurfc,,surfc}, @ref{XREFsurface,,surface}, @ref{XREFmeshgrid,,meshgrid}, @ref{XREFhidden,,hidden}, @ref{XREFshading,,shading}, @ref{XREFcolormap,,colormap}, @ref{XREFcaxis,,caxis}}
@end deftypefn
@c meshz scripts/plot/draw/meshz.m
@anchor{XREFmeshz}
@deftypefn {Function File} {} meshz (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} meshz (@var{z})
@deftypefnx {Function File} {} meshz (@dots{}, @var{c})
@deftypefnx {Function File} {} meshz (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} meshz (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} meshz (@dots{})
Plot a 3-D wireframe mesh with a surrounding curtain.
The wireframe mesh is plotted using rectangles. The vertices of the
rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
over a 2-D rectangular region in the x-y plane. @var{z} determines the
height above the plane of each vertex. If only a single @var{z} matrix is
given, then it is plotted over the meshgrid
@code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
Thus, columns of @var{z} correspond to different @var{x} values and rows
of @var{z} correspond to different @var{y} values.
The color of the mesh is computed by linearly scaling the @var{z} values
to fit the range of the current colormap. Use @code{caxis} and/or
change the colormap to control the appearance.
Optionally the color of the mesh can be specified independently of @var{z}
by supplying a color matrix, @var{c}.
Any property/value pairs are passed directly to the underlying surface
object.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
surface object.
@seealso{@ref{XREFmesh,,mesh}, @ref{XREFmeshc,,meshc}, @ref{XREFcontour,,contour}, @ref{XREFsurf,,surf}, @ref{XREFsurface,,surface}, @ref{XREFwaterfall,,waterfall}, @ref{XREFmeshgrid,,meshgrid}, @ref{XREFhidden,,hidden}, @ref{XREFshading,,shading}, @ref{XREFcolormap,,colormap}, @ref{XREFcaxis,,caxis}}
@end deftypefn
@c hidden scripts/plot/appearance/hidden.m
@anchor{XREFhidden}
@deftypefn {Command} {} hidden
@deftypefnx {Command} {} hidden "on"
@deftypefnx {Command} {} hidden "off"
@deftypefnx {Function File} {@var{mode} =} hidden (@dots{})
Control mesh hidden line removal.
When called with no argument the hidden line removal state is toggled.
When called with one of the modes @qcode{"on"} or @qcode{"off"} the state
is set accordingly.
The optional output argument @var{mode} is the current state.
Hidden Line Removal determines what graphic objects behind a mesh plot
are visible. The default is for the mesh to be opaque and lines behind
the mesh are not visible. If hidden line removal is turned off then
objects behind the mesh can be seen through the faces (openings) of the
mesh, although the mesh grid lines are still opaque.
@seealso{@ref{XREFmesh,,mesh}, @ref{XREFmeshc,,meshc}, @ref{XREFmeshz,,meshz}, @ref{XREFezmesh,,ezmesh}, @ref{XREFezmeshc,,ezmeshc}, @ref{XREFtrimesh,,trimesh}, @ref{XREFwaterfall,,waterfall}}
@end deftypefn
@c surf scripts/plot/draw/surf.m
@anchor{XREFsurf}
@deftypefn {Function File} {} surf (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} surf (@var{z})
@deftypefnx {Function File} {} surf (@dots{}, @var{c})
@deftypefnx {Function File} {} surf (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} surf (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} surf (@dots{})
Plot a 3-D surface mesh.
The surface mesh is plotted using shaded rectangles. The vertices of the
rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
over a 2-D rectangular region in the x-y plane. @var{z} determines the
height above the plane of each vertex. If only a single @var{z} matrix is
given, then it is plotted over the meshgrid
@code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
Thus, columns of @var{z} correspond to different @var{x} values and rows
of @var{z} correspond to different @var{y} values.
The color of the surface is computed by linearly scaling the @var{z} values
to fit the range of the current colormap. Use @code{caxis} and/or
change the colormap to control the appearance.
Optionally, the color of the surface can be specified independently of
@var{z} by supplying a color matrix, @var{c}.
Any property/value pairs are passed directly to the underlying surface
object.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
surface object.
Note: The exact appearance of the surface can be controlled with the
@code{shading} command or by using @code{set} to control surface object
properties.
@seealso{@ref{XREFezsurf,,ezsurf}, @ref{XREFsurfc,,surfc}, @ref{XREFsurfl,,surfl}, @ref{XREFsurfnorm,,surfnorm}, @ref{XREFtrisurf,,trisurf}, @ref{XREFcontour,,contour}, @ref{XREFmesh,,mesh}, @ref{XREFsurface,,surface}, @ref{XREFmeshgrid,,meshgrid}, @ref{XREFhidden,,hidden}, @ref{XREFshading,,shading}, @ref{XREFcolormap,,colormap}, @ref{XREFcaxis,,caxis}}
@end deftypefn
@c surfc scripts/plot/draw/surfc.m
@anchor{XREFsurfc}
@deftypefn {Function File} {} surfc (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} surfc (@var{z})
@deftypefnx {Function File} {} surfc (@dots{}, @var{c})
@deftypefnx {Function File} {} surfc (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} surfc (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} surfc (@dots{})
Plot a 3-D surface mesh with underlying contour lines.
The surface mesh is plotted using shaded rectangles. The vertices of the
rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
over a 2-D rectangular region in the x-y plane. @var{z} determines the
height above the plane of each vertex. If only a single @var{z} matrix is
given, then it is plotted over the meshgrid
@code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
Thus, columns of @var{z} correspond to different @var{x} values and rows
of @var{z} correspond to different @var{y} values.
The color of the surface is computed by linearly scaling the @var{z} values
to fit the range of the current colormap. Use @code{caxis} and/or
change the colormap to control the appearance.
Optionally, the color of the surface can be specified independently of
@var{z} by supplying a color matrix, @var{c}.
Any property/value pairs are passed directly to the underlying surface
object.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
surface object.
Note: The exact appearance of the surface can be controlled with the
@code{shading} command or by using @code{set} to control surface object
properties.
@seealso{@ref{XREFezsurfc,,ezsurfc}, @ref{XREFsurf,,surf}, @ref{XREFsurfl,,surfl}, @ref{XREFsurfnorm,,surfnorm}, @ref{XREFtrisurf,,trisurf}, @ref{XREFcontour,,contour}, @ref{XREFmesh,,mesh}, @ref{XREFsurface,,surface}, @ref{XREFmeshgrid,,meshgrid}, @ref{XREFhidden,,hidden}, @ref{XREFshading,,shading}, @ref{XREFcolormap,,colormap}, @ref{XREFcaxis,,caxis}}
@end deftypefn
@c surfl scripts/plot/draw/surfl.m
@anchor{XREFsurfl}
@deftypefn {Function File} {} surfl (@var{z})
@deftypefnx {Function File} {} surfl (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} surfl (@dots{}, @var{lsrc})
@deftypefnx {Function File} {} surfl (@var{x}, @var{y}, @var{z}, @var{lsrc}, @var{P})
@deftypefnx {Function File} {} surfl (@dots{}, "cdata")
@deftypefnx {Function File} {} surfl (@dots{}, "light")
@deftypefnx {Function File} {} surfl (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} surfl (@dots{})
Plot a 3-D surface using shading based on various lighting models.
The surface mesh is plotted using shaded rectangles. The vertices of the
rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
over a 2-D rectangular region in the x-y plane. @var{z} determines the
height above the plane of each vertex. If only a single @var{z} matrix is
given, then it is plotted over the meshgrid
@code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
Thus, columns of @var{z} correspond to different @var{x} values and rows
of @var{z} correspond to different @var{y} values.
The default lighting mode @qcode{"cdata"}, changes the cdata property of the
surface object to give the impression of a lighted surface.
@strong{Warning:} The alternative mode @qcode{"light"} mode which creates a
light object to illuminate the surface is not implemented (yet).
The light source location can be specified using @var{lsrc}. It can be given
as a 2-element vector [azimuth, elevation] in degrees, or as a 3-element
vector [lx, ly, lz]. The default value is rotated 45 degrees
counterclockwise to the current view.
The material properties of the surface can specified using a 4-element
vector @var{P} = [@var{AM} @var{D} @var{SP} @var{exp}] which defaults to
@var{p} = [0.55 0.6 0.4 10].
@table @asis
@item @qcode{"AM"} strength of ambient light
@item @qcode{"D"} strength of diffuse reflection
@item @qcode{"SP"} strength of specular reflection
@item @qcode{"EXP"} specular exponent
@end table
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
surface object.
Example:
@example
@group
colormap (bone (64));
surfl (peaks);
shading interp;
@end group
@end example
@seealso{@ref{XREFdiffuse,,diffuse}, @ref{XREFspecular,,specular}, @ref{XREFsurf,,surf}, @ref{XREFshading,,shading}, @ref{XREFcolormap,,colormap}, @ref{XREFcaxis,,caxis}}
@end deftypefn
@c surfnorm scripts/plot/draw/surfnorm.m
@anchor{XREFsurfnorm}
@deftypefn {Function File} {} surfnorm (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} surfnorm (@var{z})
@deftypefnx {Function File} {[@var{nx}, @var{ny}, @var{nz}] =} surfnorm (@dots{})
@deftypefnx {Function File} {} surfnorm (@var{h}, @dots{})
Find the vectors normal to a meshgridded surface. The meshed gridded
surface is defined by @var{x}, @var{y}, and @var{z}. If @var{x} and
@var{y} are not defined, then it is assumed that they are given by
@example
@group
[@var{x}, @var{y}] = meshgrid (1:rows (@var{z}),
1:columns (@var{z}));
@end group
@end example
If no return arguments are requested, a surface plot with the normal
vectors to the surface is plotted. Otherwise the components of the normal
vectors at the mesh gridded points are returned in @var{nx}, @var{ny},
and @var{nz}.
The normal vectors are calculated by taking the cross product of the
diagonals of each of the quadrilaterals in the meshgrid to find the
normal vectors of the centers of these quadrilaterals. The four nearest
normal vectors to the meshgrid points are then averaged to obtain the
normal to the surface at the meshgridded points.
An example of the use of @code{surfnorm} is
@example
surfnorm (peaks (25));
@end example
@seealso{@ref{XREFsurf,,surf}, @ref{XREFquiver3,,quiver3}}
@end deftypefn
@c isosurface scripts/plot/draw/isosurface.m
@anchor{XREFisosurface}
@deftypefn {Function File} {[@var{fv}] =} isosurface (@var{val}, @var{iso})
@deftypefnx {Function File} {[@var{fv}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
@deftypefnx {Function File} {[@var{fv}] =} isosurface (@dots{}, "noshare", "verbose")
@deftypefnx {Function File} {[@var{fvc}] =} isosurface (@dots{}, @var{col})
@deftypefnx {Function File} {[@var{f}, @var{v}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
@deftypefnx {Function File} {[@var{f}, @var{v}, @var{c}] =} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
@deftypefnx {Function File} {} isosurface (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col}, @var{opt})
If called with one output argument and the first input argument
@var{val} is a three-dimensional array that contains the data of an
isosurface geometry and the second input argument @var{iso} keeps the
isovalue as a scalar value then return a structure array @var{fv}
that contains the fields @var{Faces} and @var{Vertices} at computed
points @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}. The output
argument @var{fv} can directly be taken as an input argument for the
@command{patch} function.
If called with further input arguments @var{x}, @var{y} and @var{z}
which are three--dimensional arrays with the same size than @var{val}
then the volume data is taken at those given points.
The string input argument @qcode{"noshare"} is only for compatibility and
has no effect. If given the string input argument
@qcode{"verbose"} then print messages to the command line interface about the
current progress.
If called with the input argument @var{col} which is a
three-dimensional array of the same size than @var{val} then take
those values for the interpolation of coloring the isosurface
geometry. Add the field @var{FaceVertexCData} to the structure
array @var{fv}.
If called with two or three output arguments then return the
information about the faces @var{f}, vertices @var{v} and color data
@var{c} as separate arrays instead of a single structure array.
If called with no output argument then directly process the
isosurface geometry with the @command{patch} command.
For example,
@example
@group
[x, y, z] = meshgrid (1:5, 1:5, 1:5);
val = rand (5, 5, 5);
isosurface (x, y, z, val, .5);
@end group
@end example
@noindent
will directly draw a random isosurface geometry in a graphics window.
Another example for an isosurface geometry with different additional
coloring
@c Set example in small font to prevent overfull line
@smallexample
N = 15; # Increase number of vertices in each direction
iso = .4; # Change isovalue to .1 to display a sphere
lin = linspace (0, 2, N);
[x, y, z] = meshgrid (lin, lin, lin);
c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
figure (); # Open another figure window
subplot (2,2,1); view (-38, 20);
[f, v] = isosurface (x, y, z, c, iso);
p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
set (gca, "PlotBoxAspectRatioMode", "manual", ...
"PlotBoxAspectRatio", [1 1 1]);
# set (p, "FaceColor", "green", "FaceLighting", "phong");
# light ("Position", [1 1 5]); # Available with the JHandles package
subplot (2,2,2); view (-38, 20);
p = patch ("Faces", f, "Vertices", v, "EdgeColor", "blue");
set (gca, "PlotBoxAspectRatioMode", "manual", ...
"PlotBoxAspectRatio", [1 1 1]);
# set (p, "FaceColor", "none", "FaceLighting", "phong");
# light ("Position", [1 1 5]);
subplot (2,2,3); view (-38, 20);
[f, v, c] = isosurface (x, y, z, c, iso, y);
p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, ...
"FaceColor", "interp", "EdgeColor", "none");
set (gca, "PlotBoxAspectRatioMode", "manual", ...
"PlotBoxAspectRatio", [1 1 1]);
# set (p, "FaceLighting", "phong");
# light ("Position", [1 1 5]);
subplot (2,2,4); view (-38, 20);
p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, ...
"FaceColor", "interp", "EdgeColor", "blue");
set (gca, "PlotBoxAspectRatioMode", "manual", ...
"PlotBoxAspectRatio", [1 1 1]);
# set (p, "FaceLighting", "phong");
# light ("Position", [1 1 5]);
@end smallexample
@seealso{@ref{XREFisonormals,,isonormals}, @ref{XREFisocolors,,isocolors}}
@end deftypefn
@c isonormals scripts/plot/draw/isonormals.m
@anchor{XREFisonormals}
@deftypefn {Function File} {[@var{n}] =} isonormals (@var{val}, @var{v})
@deftypefnx {Function File} {[@var{n}] =} isonormals (@var{val}, @var{p})
@deftypefnx {Function File} {[@var{n}] =} isonormals (@var{x}, @var{y}, @var{z}, @var{val}, @var{v})
@deftypefnx {Function File} {[@var{n}] =} isonormals (@var{x}, @var{y}, @var{z}, @var{val}, @var{p})
@deftypefnx {Function File} {[@var{n}] =} isonormals (@dots{}, "negate")
@deftypefnx {Function File} {} isonormals (@dots{}, @var{p})
If called with one output argument and the first input argument
@var{val} is a three-dimensional array that contains the data for an
isosurface geometry and the second input argument @var{v} keeps the
vertices of an isosurface then return the normals @var{n} in form of
a matrix with the same size than @var{v} at computed points
@command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}. The output argument
@var{n} can be taken to manually set @var{VertexNormals} of a patch.
If called with further input arguments @var{x}, @var{y} and @var{z}
which are three--dimensional arrays with the same size than @var{val}
then the volume data is taken at those given points. Instead of the
vertices data @var{v} a patch handle @var{p} can be passed to this
function.
If given the string input argument @qcode{"negate"} as last input argument
then compute the reverse vector normals of an isosurface geometry.
If no output argument is given then directly redraw the patch that is
given by the patch handle @var{p}.
For example:
@c Set example in small font to prevent overfull line
@smallexample
function [] = isofinish (p)
set (gca, "PlotBoxAspectRatioMode", "manual", ...
"PlotBoxAspectRatio", [1 1 1]);
set (p, "VertexNormals", -get (p,"VertexNormals")); # Revert normals
set (p, "FaceColor", "interp");
## set (p, "FaceLighting", "phong");
## light ("Position", [1 1 5]); # Available with JHandles
endfunction
N = 15; # Increase number of vertices in each direction
iso = .4; # Change isovalue to .1 to display a sphere
lin = linspace (0, 2, N);
[x, y, z] = meshgrid (lin, lin, lin);
c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
figure (); # Open another figure window
subplot (2,2,1); view (-38, 20);
[f, v, cdat] = isosurface (x, y, z, c, iso, y);
p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
"FaceColor", "interp", "EdgeColor", "none");
isofinish (p); ## Call user function isofinish
subplot (2,2,2); view (-38, 20);
p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
"FaceColor", "interp", "EdgeColor", "none");
isonormals (x, y, z, c, p); # Directly modify patch
isofinish (p);
subplot (2,2,3); view (-38, 20);
p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
"FaceColor", "interp", "EdgeColor", "none");
n = isonormals (x, y, z, c, v); # Compute normals of isosurface
set (p, "VertexNormals", n); # Manually set vertex normals
isofinish (p);
subplot (2,2,4); view (-38, 20);
p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ...
"FaceColor", "interp", "EdgeColor", "none");
isonormals (x, y, z, c, v, "negate"); # Use reverse directly
isofinish (p);
@end smallexample
@seealso{@ref{XREFisosurface,,isosurface}, @ref{XREFisocolors,,isocolors}}
@end deftypefn
@c isocolors scripts/plot/draw/isocolors.m
@anchor{XREFisocolors}
@deftypefn {Function File} {[@var{cd}] =} isocolors (@var{c}, @var{v})
@deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{x}, @var{y}, @var{z}, @var{c}, @var{v})
@deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{x}, @var{y}, @var{z}, @var{r}, @var{g}, @var{b}, @var{v})
@deftypefnx {Function File} {[@var{cd}] =} isocolors (@var{r}, @var{g}, @var{b}, @var{v})
@deftypefnx {Function File} {[@var{cd}] =} isocolors (@dots{}, @var{p})
@deftypefnx {Function File} {} isocolors (@dots{})
If called with one output argument and the first input argument
@var{c} is a three-dimensional array that contains color values and
the second input argument @var{v} keeps the vertices of a geometry
then return a matrix @var{cd} with color data information for the
geometry at computed points
@command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}. The output argument
@var{cd} can be taken to manually set FaceVertexCData of a patch.
If called with further input arguments @var{x}, @var{y} and @var{z}
which are three--dimensional arrays of the same size than @var{c}
then the color data is taken at those given points. Instead of the
color data @var{c} this function can also be called with RGB values
@var{r}, @var{g}, @var{b}. If input argumnets @var{x}, @var{y},
@var{z} are not given then again @command{meshgrid} computed values
are taken.
Optionally, the patch handle @var{p} can be given as the last input
argument to all variations of function calls instead of the vertices
data @var{v}. Finally, if no output argument is given then directly
change the colors of a patch that is given by the patch handle
@var{p}.
For example:
@example
function [] = isofinish (p)
set (gca, "PlotBoxAspectRatioMode", "manual", ...
"PlotBoxAspectRatio", [1 1 1]);
set (p, "FaceColor", "interp");
## set (p, "FaceLighting", "flat");
## light ("Position", [1 1 5]); ## Available with JHandles
endfunction
N = 15; # Increase number of vertices in each direction
iso = .4; # Change isovalue to .1 to display a sphere
lin = linspace (0, 2, N);
[x, y, z] = meshgrid (lin, lin, lin);
c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2);
figure (); # Open another figure window
subplot (2,2,1); view (-38, 20);
[f, v] = isosurface (x, y, z, c, iso);
p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
cdat = rand (size (c)); # Compute random patch color data
isocolors (x, y, z, cdat, p); # Directly set colors of patch
isofinish (p); # Call user function isofinish
subplot (2,2,2); view (-38, 20);
p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
[r, g, b] = meshgrid (lin, 2-lin, 2-lin);
cdat = isocolors (x, y, z, c, v); # Compute color data vertices
set (p, "FaceVertexCData", cdat); # Set color data manually
isofinish (p);
subplot (2,2,3); view (-38, 20);
p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
cdat = isocolors (r, g, b, c, p); # Compute color data patch
set (p, "FaceVertexCData", cdat); # Set color data manually
isofinish (p);
subplot (2,2,4); view (-38, 20);
p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none");
r = g = b = repmat ([1:N] / N, [N, 1, N]); # Black to white
cdat = isocolors (x, y, z, r, g, b, v);
set (p, "FaceVertexCData", cdat);
isofinish (p);
@end example
@seealso{@ref{XREFisosurface,,isosurface}, @ref{XREFisonormals,,isonormals}}
@end deftypefn
@c shrinkfaces scripts/plot/draw/shrinkfaces.m
@anchor{XREFshrinkfaces}
@deftypefn {Function File} {} shrinkfaces (@var{p}, @var{sf})
@deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{p}, @var{sf})
@deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{fv}, @var{sf})
@deftypefnx {Function File} {@var{nfv} =} shrinkfaces (@var{f}, @var{v}, @var{sf})
@deftypefnx {Function File} {[@var{nf}, @var{nv}] =} shrinkfaces (@dots{})
Reduce the faces area for a given patch, structure or explicit faces
and points matrices by a scale factor @var{sf}. The structure
@var{fv} must contain the fields @qcode{"faces"} and @qcode{"vertices"}.
If the factor @var{sf} is omitted then a default of 0.3 is used.
Given a patch handle as the first input argument and no output
parameters, perform the shrinking of the patch faces in place and
redraw the patch.
If called with one output argument, return a structure with fields
@qcode{"faces"}, @qcode{"vertices"}, and @qcode{"facevertexcdata"}
containing the data after shrinking which can then directly be used as an
input argument for the @code{patch} function.
Performing the shrinking on faces which are not convex can lead to
undesired results.
For example,
@example
@group
[phi r] = meshgrid (linspace (0, 1.5*pi, 16), linspace (1, 2, 4));
tri = delaunay (phi(:), r(:));
v = [r(:).*sin(phi(:)) r(:).*cos(phi(:))];
clf ()
p = patch ("Faces", tri, "Vertices", v, "FaceColor", "none");
fv = shrinkfaces (p);
patch (fv)
axis equal
grid on
@end group
@end example
@noindent
draws a triangulated 3/4 circle and the corresponding shrunken
version.
@seealso{@ref{XREFpatch,,patch}}
@end deftypefn
@c diffuse scripts/plot/appearance/diffuse.m
@anchor{XREFdiffuse}
@deftypefn {Function File} {} diffuse (@var{sx}, @var{sy}, @var{sz}, @var{lv})
Calculate diffuse reflection strength of a surface defined by the normal
vector elements @var{sx}, @var{sy}, @var{sz}.
The light source location vector @var{lv} can be given as 2-element vector
[azimuth, elevation] in degrees or as 3-element vector [lx, ly, lz].
@seealso{@ref{XREFspecular,,specular}, @ref{XREFsurfl,,surfl}}
@end deftypefn
@c specular scripts/plot/appearance/specular.m
@anchor{XREFspecular}
@deftypefn {Function File} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv})
@deftypefnx {Function File} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv}, @var{se})
Calculate specular reflection strength of a surface defined by the normal
vector elements @var{sx}, @var{sy}, @var{sz} using Phong's approximation.
The light source location and viewer location vectors can be specified using
parameter @var{lv} and @var{vv} respectively. The location vectors can
given as 2-element vectors [azimuth, elevation] in degrees or as 3-element
vectors [x, y, z].
An optional sixth argument describes the specular exponent (spread) @var{se}.
@seealso{@ref{XREFdiffuse,,diffuse}, @ref{XREFsurfl,,surfl}}
@end deftypefn
@c meshgrid scripts/plot/util/meshgrid.m
@anchor{XREFmeshgrid}
@deftypefn {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x}, @var{y})
@deftypefnx {Function File} {[@var{xx}, @var{yy}, @var{zz}] =} meshgrid (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x})
@deftypefnx {Function File} {[@var{xx}, @var{yy}, @var{zz}] =} meshgrid (@var{x})
Given vectors of @var{x} and @var{y} coordinates, return matrices @var{xx}
and @var{yy} corresponding to a full 2-D grid.
The rows of @var{xx} are copies of @var{x}, and the columns of @var{yy} are
copies of @var{y}. If @var{y} is omitted, then it is assumed to be the same
as @var{x}.
If the optional @var{z} input is given, or @var{zz} is requested, then the
output will be a full 3-D grid.
@code{meshgrid} is most frequently used to produce input for a 2-D or 3-D
function that will be plotted. The following example creates a surface
plot of the ``sombrero'' function.
@example
@group
f = @@(x,y) sin (sqrt (x.^2 + y.^2)) ./ sqrt (x.^2 + y.^2);
range = linspace (-8, 8, 41);
[@var{X}, @var{Y}] = meshgrid (range, range);
Z = f (X, Y);
surf (X, Y, Z);
@end group
@end example
Programming Note: @code{meshgrid} is restricted to 2-D or 3-D grid
generation. The @code{ndgrid} function will generate 1-D through N-D
grids. However, the functions are not completely equivalent. If @var{x}
is a vector of length M and @var{y} is a vector of length N, then
@code{meshgrid} will produce an output grid which is NxM@. @code{ndgrid}
will produce an output which is @nospell{MxN} (transpose) for the same
input. Some core functions expect @code{meshgrid} input and others expect
@code{ndgrid} input. Check the documentation for the function in question
to determine the proper input format.
@seealso{@ref{XREFndgrid,,ndgrid}, @ref{XREFmesh,,mesh}, @ref{XREFcontour,,contour}, @ref{XREFsurf,,surf}}
@end deftypefn
@c ndgrid scripts/plot/util/ndgrid.m
@anchor{XREFndgrid}
@deftypefn {Function File} {[@var{y1}, @var{y2}, @dots{}, @var{y}n] =} ndgrid (@var{x1}, @var{x2}, @dots{}, @var{x}n)
@deftypefnx {Function File} {[@var{y1}, @var{y2}, @dots{}, @var{y}n] =} ndgrid (@var{x})
Given n vectors @var{x1}, @dots{}, @var{x}n, @code{ndgrid} returns
n arrays of dimension n. The elements of the i-th output argument
contains the elements of the vector @var{x}i repeated over all
dimensions different from the i-th dimension. Calling ndgrid with
only one input argument @var{x} is equivalent to calling ndgrid with
all n input arguments equal to @var{x}:
[@var{y1}, @var{y2}, @dots{}, @var{y}n] = ndgrid (@var{x}, @dots{}, @var{x})
Programming Note: @code{ndgrid} is very similar to the function
@code{meshgrid} except that the first two dimensions are transposed in
comparison to @code{meshgrid}. Some core functions expect @code{meshgrid}
input and others expect @code{ndgrid} input. Check the documentation for
the function in question to determine the proper input format.
@seealso{@ref{XREFmeshgrid,,meshgrid}}
@end deftypefn
@c plot3 scripts/plot/draw/plot3.m
@anchor{XREFplot3}
@deftypefn {Function File} {} plot3 (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} plot3 (@var{x}, @var{y}, @var{z}, @var{prop}, @var{value}, @dots{})
@deftypefnx {Function File} {} plot3 (@var{x}, @var{y}, @var{z}, @var{fmt})
@deftypefnx {Function File} {} plot3 (@var{x}, @var{cplx})
@deftypefnx {Function File} {} plot3 (@var{cplx})
@deftypefnx {Function File} {} plot3 (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} plot3 (@dots{})
Produce 3-D plots.
Many different combinations of arguments are possible. The simplest
form is
@example
plot3 (@var{x}, @var{y}, @var{z})
@end example
@noindent
in which the arguments are taken to be the vertices of the points to
be plotted in three dimensions. If all arguments are vectors of the
same length, then a single continuous line is drawn. If all arguments
are matrices, then each column of is treated as a separate line. No attempt
is made to transpose the arguments to make the number of rows match.
If only two arguments are given, as
@example
plot3 (@var{x}, @var{cplx})
@end example
@noindent
the real and imaginary parts of the second argument are used
as the @var{y} and @var{z} coordinates, respectively.
If only one argument is given, as
@example
plot3 (@var{cplx})
@end example
@noindent
the real and imaginary parts of the argument are used as the @var{y}
and @var{z} values, and they are plotted versus their index.
Arguments may also be given in groups of three as
@example
plot3 (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}, @dots{})
@end example
@noindent
in which each set of three arguments is treated as a separate line or
set of lines in three dimensions.
To plot multiple one- or two-argument groups, separate each group
with an empty format string, as
@example
plot3 (@var{x1}, @var{c1}, "", @var{c2}, "", @dots{})
@end example
Multiple property-value pairs may be specified which will affect the line
objects drawn by @code{plot3}. If the @var{fmt} argument is supplied it
will format the line objects in the same manner as @code{plot}.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created plot.
Example:
@example
@group
z = [0:0.05:5];
plot3 (cos (2*pi*z), sin (2*pi*z), z, ";helix;");
plot3 (z, exp (2i*pi*z), ";complex sinusoid;");
@end group
@end example
@seealso{@ref{XREFezplot3,,ezplot3}, @ref{XREFplot,,plot}}
@end deftypefn
@c view scripts/plot/appearance/view.m
@anchor{XREFview}
@deftypefn {Function File} {} view (@var{azimuth}, @var{elevation})
@deftypefnx {Function File} {} view ([@var{azimuth} @var{elevation}])
@deftypefnx {Function File} {} view ([@var{x} @var{y} @var{z}])
@deftypefnx {Function File} {} view (2)
@deftypefnx {Function File} {} view (3)
@deftypefnx {Function File} {} view (@var{hax}, @dots{})
@deftypefnx {Function File} {[@var{azimuth}, @var{elevation}] =} view ()
Query or set the viewpoint for the current axes.
The parameters @var{azimuth} and @var{elevation} can be given as two
arguments or as 2-element vector. The viewpoint can also be specified with
Cartesian coordinates @var{x}, @var{y}, and @var{z}.
The call @code{view (2)} sets the viewpoint to @w{@var{azimuth} = 0}
and @w{@var{elevation} = 90}, which is the default for 2-D graphs.
The call @code{view (3)} sets the viewpoint to @w{@var{azimuth} = -37.5}
and @w{@var{elevation} = 30}, which is the default for 3-D graphs.
If the first argument @var{hax} is an axes handle, then operate on
this axis rather than the current axes returned by @code{gca}.
If no inputs are given, return the current @var{azimuth} and @var{elevation}.
@end deftypefn
@c slice scripts/plot/draw/slice.m
@anchor{XREFslice}
@deftypefn {Function File} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{sx}, @var{sy}, @var{sz})
@deftypefnx {Function File} {} slice (@var{x}, @var{y}, @var{z}, @var{v}, @var{xi}, @var{yi}, @var{zi})
@deftypefnx {Function File} {} slice (@var{v}, @var{sx}, @var{sy}, @var{sz})
@deftypefnx {Function File} {} slice (@var{v}, @var{xi}, @var{yi}, @var{zi})
@deftypefnx {Function File} {} slice (@dots{}, @var{method})
@deftypefnx {Function File} {} slice (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} slice (@dots{})
Plot slices of 3-D data/scalar fields.
Each element of the 3-dimensional array @var{v} represents a scalar value at
a location given by the parameters @var{x}, @var{y}, and @var{z}. The
parameters @var{x}, @var{x}, and @var{z} are either 3-dimensional arrays of
the same size as the array @var{v} in the @qcode{"meshgrid"} format or
vectors. The parameters @var{xi}, etc. respect a similar format to
@var{x}, etc., and they represent the points at which the array @var{vi}
is interpolated using interp3. The vectors @var{sx}, @var{sy}, and
@var{sz} contain points of orthogonal slices of the respective axes.
If @var{x}, @var{y}, @var{z} are omitted, they are assumed to be
@code{x = 1:size (@var{v}, 2)}, @code{y = 1:size (@var{v}, 1)} and
@code{z = 1:size (@var{v}, 3)}.
@var{method} is one of:
@table @asis
@item @qcode{"nearest"}
Return the nearest neighbor.
@item @qcode{"linear"}
Linear interpolation from nearest neighbors.
@item @qcode{"cubic"}
Cubic interpolation from four nearest neighbors (not implemented yet).
@item @qcode{"spline"}
Cubic spline interpolation---smooth first and second derivatives
throughout the curve.
@end table
The default method is @qcode{"linear"}.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
surface object.
Examples:
@example
@group
[x, y, z] = meshgrid (linspace (-8, 8, 32));
v = sin (sqrt (x.^2 + y.^2 + z.^2)) ./ (sqrt (x.^2 + y.^2 + z.^2));
slice (x, y, z, v, [], 0, []);
[xi, yi] = meshgrid (linspace (-7, 7));
zi = xi + yi;
slice (x, y, z, v, xi, yi, zi);
@end group
@end example
@seealso{@ref{XREFinterp3,,interp3}, @ref{XREFsurface,,surface}, @ref{XREFpcolor,,pcolor}}
@end deftypefn
@c ribbon scripts/plot/draw/ribbon.m
@anchor{XREFribbon}
@deftypefn {Function File} {} ribbon (@var{y})
@deftypefnx {Function File} {} ribbon (@var{x}, @var{y})
@deftypefnx {Function File} {} ribbon (@var{x}, @var{y}, @var{width})
@deftypefnx {Function File} {} ribbon (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} ribbon (@dots{})
Plot a ribbon plot for the columns of @var{y} vs. @var{x}.
The optional parameter @var{width} specifies the width of a single ribbon
(default is 0.75). If @var{x} is omitted, a vector containing the
row numbers is assumed (@code{1:rows (Y)}).
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a vector of graphics handles to
the surface objects representing each ribbon.
@seealso{@ref{XREFsurface,,surface}, @ref{XREFwaterfall,,waterfall}}
@end deftypefn
@c shading scripts/plot/appearance/shading.m
@anchor{XREFshading}
@deftypefn {Function File} {} shading (@var{type})
@deftypefnx {Function File} {} shading (@var{hax}, @var{type})
Set the shading of patch or surface graphic objects.
Valid arguments for @var{type} are
@table @asis
@item @qcode{"flat"}
Single colored patches with invisible edges.
@item @qcode{"faceted"}
Single colored patches with visible edges.
@item @qcode{"interp"}
Color between patch vertices are interpolated and the patch edges are
invisible.
@end table
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
@seealso{@ref{XREFfill,,fill}, @ref{XREFmesh,,mesh}, @ref{XREFpatch,,patch}, @ref{XREFpcolor,,pcolor}, @ref{XREFsurf,,surf}, @ref{XREFsurface,,surface}, @ref{XREFhidden,,hidden}}
@end deftypefn
@c scatter3 scripts/plot/draw/scatter3.m
@anchor{XREFscatter3}
@deftypefn {Function File} {} scatter3 (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} scatter3 (@var{x}, @var{y}, @var{z}, @var{s})
@deftypefnx {Function File} {} scatter3 (@var{x}, @var{y}, @var{z}, @var{s}, @var{c})
@deftypefnx {Function File} {} scatter3 (@dots{}, @var{style})
@deftypefnx {Function File} {} scatter3 (@dots{}, "filled")
@deftypefnx {Function File} {} scatter3 (@dots{}, @var{prop}, @var{val})
@deftypefnx {Function File} {} scatter3 (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} scatter3 (@dots{})
Draw a 3-D scatter plot.
A marker is plotted at each point defined by the coordinates in the vectors
@var{x}, @var{y}, and @var{z}.
The size of the markers is determined by @var{s}, which can be a scalar
or a vector of the same length as @var{x}, @var{y}, and @var{z}. If @var{s}
is not given, or is an empty matrix, then a default value of 8 points is
used.
The color of the markers is determined by @var{c}, which can be a string
defining a fixed color; a 3-element vector giving the red, green, and blue
components of the color; a vector of the same length as @var{x} that gives
a scaled index into the current colormap; or an @nospell{Nx3} matrix defining
the RGB color of each marker individually.
The marker to use can be changed with the @var{style} argument, that is a
string defining a marker in the same manner as the @code{plot} command.
If no marker is specified it defaults to @qcode{"o"} or circles.
If the argument @qcode{"filled"} is given then the markers are filled.
Additional property/value pairs are passed directly to the underlying
patch object.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the hggroup
object representing the points.
@example
@group
[x, y, z] = peaks (20);
scatter3 (x(:), y(:), z(:), [], z(:));
@end group
@end example
@seealso{@ref{XREFscatter,,scatter}, @ref{XREFpatch,,patch}, @ref{XREFplot,,plot}}
@end deftypefn
@c waterfall scripts/plot/draw/waterfall.m
@anchor{XREFwaterfall}
@deftypefn {Function File} {} waterfall (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} waterfall (@var{z})
@deftypefnx {Function File} {} waterfall (@dots{}, @var{c})
@deftypefnx {Function File} {} waterfall (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} waterfall (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} waterfall (@dots{})
Plot a 3-D waterfall plot.
A waterfall plot is similar to a @code{meshz} plot except only
mesh lines for the rows of @var{z} (x-values) are shown.
The wireframe mesh is plotted using rectangles. The vertices of the
rectangles [@var{x}, @var{y}] are typically the output of @code{meshgrid}.
over a 2-D rectangular region in the x-y plane. @var{z} determines the
height above the plane of each vertex. If only a single @var{z} matrix is
given, then it is plotted over the meshgrid
@code{@var{x} = 1:columns (@var{z}), @var{y} = 1:rows (@var{z})}.
Thus, columns of @var{z} correspond to different @var{x} values and rows
of @var{z} correspond to different @var{y} values.
The color of the mesh is computed by linearly scaling the @var{z} values
to fit the range of the current colormap. Use @code{caxis} and/or
change the colormap to control the appearance.
Optionally the color of the mesh can be specified independently of @var{z}
by supplying a color matrix, @var{c}.
Any property/value pairs are passed directly to the underlying surface
object.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
surface object.
@seealso{@ref{XREFmeshz,,meshz}, @ref{XREFmesh,,mesh}, @ref{XREFmeshc,,meshc}, @ref{XREFcontour,,contour}, @ref{XREFsurf,,surf}, @ref{XREFsurface,,surface}, @ref{XREFribbon,,ribbon}, @ref{XREFmeshgrid,,meshgrid}, @ref{XREFhidden,,hidden}, @ref{XREFshading,,shading}, @ref{XREFcolormap,,colormap}, @ref{XREFcaxis,,caxis}}
@end deftypefn
@menu
* Aspect Ratio::
* Three-dimensional Function Plotting::
* Three-dimensional Geometric Shapes::
@end menu
@node Aspect Ratio
@subsubsection Aspect Ratio
For three-dimensional plots the aspect ratio can be set for data with
@code{daspect} and for the plot box with @code{pbaspect}.
@xref{Axis Configuration}, for controlling the x-, y-, and z-limits for
plotting.
@c daspect scripts/plot/appearance/daspect.m
@anchor{XREFdaspect}
@deftypefn {Function File} {@var{data_aspect_ratio} =} daspect ()
@deftypefnx {Function File} {} daspect (@var{data_aspect_ratio})
@deftypefnx {Function File} {} daspect (@var{mode})
@deftypefnx {Function File} {@var{data_aspect_ratio_mode} =} daspect ("mode")
@deftypefnx {Function File} {} daspect (@var{hax}, @dots{})
Query or set the data aspect ratio of the current axes.
The aspect ratio is a normalized 3-element vector representing the span of
the x, y, and z-axis limits.
@code{daspect (@var{mode})}
Set the data aspect ratio mode of the current axes. @var{mode} is
either @qcode{"auto"} or @qcode{"manual"}.
@code{daspect (@qcode{"mode"})}
Return the data aspect ratio mode of the current axes.
@code{daspect (@var{hax}, @dots{})}
Operate on the axes in handle @var{hax} instead of the current axes.
@seealso{@ref{XREFaxis,,axis}, @ref{XREFpbaspect,,pbaspect}, @ref{XREFxlim,,xlim}, @ref{XREFylim,,ylim}, @ref{XREFzlim,,zlim}}
@end deftypefn
@c pbaspect scripts/plot/appearance/pbaspect.m
@anchor{XREFpbaspect}
@deftypefn {Function File} {@var{plot_box_aspect_ratio} =} pbaspect ( )
@deftypefnx {Function File} {} pbaspect (@var{plot_box_aspect_ratio})
@deftypefnx {Function File} {} pbaspect (@var{mode})
@deftypefnx {Function File} {@var{plot_box_aspect_ratio_mode} =} pbaspect ("mode")
@deftypefnx {Function File} {} pbaspect (@var{hax}, @dots{})
Query or set the plot box aspect ratio of the current axes.
The aspect ratio is a normalized 3-element vector representing the rendered
lengths of the x, y, and z axes.
@code{pbaspect(@var{mode})}
Set the plot box aspect ratio mode of the current axes. @var{mode} is
either @qcode{"auto"} or @qcode{"manual"}.
@code{pbaspect ("mode")}
Return the plot box aspect ratio mode of the current axes.
@code{pbaspect (@var{hax}, @dots{})}
Operate on the axes in handle @var{hax} instead of the current axes.
@seealso{@ref{XREFaxis,,axis}, @ref{XREFdaspect,,daspect}, @ref{XREFxlim,,xlim}, @ref{XREFylim,,ylim}, @ref{XREFzlim,,zlim}}
@end deftypefn
@node Three-dimensional Function Plotting
@subsubsection Three-dimensional Function Plotting
@c ezplot3 scripts/plot/draw/ezplot3.m
@anchor{XREFezplot3}
@deftypefn {Function File} {} ezplot3 (@var{fx}, @var{fy}, @var{fz})
@deftypefnx {Function File} {} ezplot3 (@dots{}, @var{dom})
@deftypefnx {Function File} {} ezplot3 (@dots{}, @var{n})
@deftypefnx {Function File} {} ezplot3 (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} ezplot3 (@dots{})
Plot a parametrically defined curve in three dimensions.
@var{fx}, @var{fy}, and @var{fz} are strings, inline functions,
or function handles with one argument defining the function. By
default the plot is over the domain @code{0 <= @var{t} <= 2*pi}
with 500 points.
If @var{dom} is a two element vector, it represents the minimum and maximum
values of @var{t}.
@var{n} is a scalar defining the number of points to use in plotting the
function.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created plot.
@example
@group
fx = @@(t) cos (t);
fy = @@(t) sin (t);
fz = @@(t) t;
ezplot3 (fx, fy, fz, [0, 10*pi], 100);
@end group
@end example
@seealso{@ref{XREFplot3,,plot3}, @ref{XREFezplot,,ezplot}, @ref{XREFezmesh,,ezmesh}, @ref{XREFezsurf,,ezsurf}}
@end deftypefn
@c ezmesh scripts/plot/draw/ezmesh.m
@anchor{XREFezmesh}
@deftypefn {Function File} {} ezmesh (@var{f})
@deftypefnx {Function File} {} ezmesh (@var{fx}, @var{fy}, @var{fz})
@deftypefnx {Function File} {} ezmesh (@dots{}, @var{dom})
@deftypefnx {Function File} {} ezmesh (@dots{}, @var{n})
@deftypefnx {Function File} {} ezmesh (@dots{}, "circ")
@deftypefnx {Function File} {} ezmesh (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} ezmesh (@dots{})
Plot the mesh defined by a function.
@var{f} is a string, inline function, or function handle with two arguments
defining the function. By default the plot is over the meshed domain
@code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
If three functions are passed, then plot the parametrically defined
function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
@var{fz} (@var{s}, @var{t})]}.
If @var{dom} is a two element vector, it represents the minimum and maximum
values of both @var{x} and @var{y}. If @var{dom} is a four element vector,
then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
@var{n} is a scalar defining the number of points to use in each dimension.
If the argument @qcode{"circ"} is given, then the function is plotted over
a disk centered on the middle of the domain @var{dom}.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
surface object.
Example 1: 2-argument function
@example
@group
f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
ezmesh (f, [-3, 3]);
@end group
@end example
Example 2: parametrically defined function
@example
@group
fx = @@(s,t) cos (s) .* cos (t);
fy = @@(s,t) sin (s) .* cos (t);
fz = @@(s,t) sin (t);
ezmesh (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
@end group
@end example
@seealso{@ref{XREFmesh,,mesh}, @ref{XREFezmeshc,,ezmeshc}, @ref{XREFezplot,,ezplot}, @ref{XREFezsurf,,ezsurf}, @ref{XREFezsurfc,,ezsurfc}, @ref{XREFhidden,,hidden}}
@end deftypefn
@c ezmeshc scripts/plot/draw/ezmeshc.m
@anchor{XREFezmeshc}
@deftypefn {Function File} {} ezmeshc (@var{f})
@deftypefnx {Function File} {} ezmeshc (@var{fx}, @var{fy}, @var{fz})
@deftypefnx {Function File} {} ezmeshc (@dots{}, @var{dom})
@deftypefnx {Function File} {} ezmeshc (@dots{}, @var{n})
@deftypefnx {Function File} {} ezmeshc (@dots{}, "circ")
@deftypefnx {Function File} {} ezmeshc (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} ezmeshc (@dots{})
Plot the mesh and contour lines defined by a function.
@var{f} is a string, inline function, or function handle with two arguments
defining the function. By default the plot is over the meshed domain
@code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
If three functions are passed, then plot the parametrically defined
function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
@var{fz} (@var{s}, @var{t})]}.
If @var{dom} is a two element vector, it represents the minimum and maximum
values of both @var{x} and @var{y}. If @var{dom} is a four element vector,
then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
@var{n} is a scalar defining the number of points to use in each dimension.
If the argument @qcode{"circ"} is given, then the function is plotted over
a disk centered on the middle of the domain @var{dom}.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a 2-element vector with a graphics
handle for the created mesh plot and a second handle for the created contour
plot.
Example: 2-argument function
@example
@group
f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
ezmeshc (f, [-3, 3]);
@end group
@end example
@seealso{@ref{XREFmeshc,,meshc}, @ref{XREFezmesh,,ezmesh}, @ref{XREFezplot,,ezplot}, @ref{XREFezsurf,,ezsurf}, @ref{XREFezsurfc,,ezsurfc}, @ref{XREFhidden,,hidden}}
@end deftypefn
@c ezsurf scripts/plot/draw/ezsurf.m
@anchor{XREFezsurf}
@deftypefn {Function File} {} ezsurf (@var{f})
@deftypefnx {Function File} {} ezsurf (@var{fx}, @var{fy}, @var{fz})
@deftypefnx {Function File} {} ezsurf (@dots{}, @var{dom})
@deftypefnx {Function File} {} ezsurf (@dots{}, @var{n})
@deftypefnx {Function File} {} ezsurf (@dots{}, "circ")
@deftypefnx {Function File} {} ezsurf (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} ezsurf (@dots{})
Plot the surface defined by a function.
@var{f} is a string, inline function, or function handle with two arguments
defining the function. By default the plot is over the meshed domain
@code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
If three functions are passed, then plot the parametrically defined
function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
@var{fz} (@var{s}, @var{t})]}.
If @var{dom} is a two element vector, it represents the minimum and maximum
values of both @var{x} and @var{y}. If @var{dom} is a four element vector,
then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
@var{n} is a scalar defining the number of points to use in each dimension.
If the argument @qcode{"circ"} is given, then the function is plotted over
a disk centered on the middle of the domain @var{dom}.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
surface object.
Example 1: 2-argument function
@example
@group
f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
ezsurf (f, [-3, 3]);
@end group
@end example
Example 2: parametrically defined function
@example
@group
fx = @@(s,t) cos (s) .* cos (t);
fy = @@(s,t) sin (s) .* cos (t);
fz = @@(s,t) sin (t);
ezsurf (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
@end group
@end example
@seealso{@ref{XREFsurf,,surf}, @ref{XREFezsurfc,,ezsurfc}, @ref{XREFezplot,,ezplot}, @ref{XREFezmesh,,ezmesh}, @ref{XREFezmeshc,,ezmeshc}, @ref{XREFshading,,shading}}
@end deftypefn
@c ezsurfc scripts/plot/draw/ezsurfc.m
@anchor{XREFezsurfc}
@deftypefn {Function File} {} ezsurfc (@var{f})
@deftypefnx {Function File} {} ezsurfc (@var{fx}, @var{fy}, @var{fz})
@deftypefnx {Function File} {} ezsurfc (@dots{}, @var{dom})
@deftypefnx {Function File} {} ezsurfc (@dots{}, @var{n})
@deftypefnx {Function File} {} ezsurfc (@dots{}, "circ")
@deftypefnx {Function File} {} ezsurfc (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} ezsurfc (@dots{})
Plot the surface and contour lines defined by a function.
@var{f} is a string, inline function, or function handle with two arguments
defining the function. By default the plot is over the meshed domain
@code{-2*pi <= @var{x} | @var{y} <= 2*pi} with 60 points in each dimension.
If three functions are passed, then plot the parametrically defined
function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}),
@var{fz} (@var{s}, @var{t})]}.
If @var{dom} is a two element vector, it represents the minimum and maximum
values of both @var{x} and @var{y}. If @var{dom} is a four element vector,
then the minimum and maximum values are @code{[xmin xmax ymin ymax]}.
@var{n} is a scalar defining the number of points to use in each dimension.
If the argument @qcode{"circ"} is given, then the function is plotted over
a disk centered on the middle of the domain @var{dom}.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a 2-element vector with a graphics
handle for the created surface plot and a second handle for the created
contour plot.
Example:
@example
@group
f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2);
ezsurfc (f, [-3, 3]);
@end group
@end example
@seealso{@ref{XREFsurfc,,surfc}, @ref{XREFezsurf,,ezsurf}, @ref{XREFezplot,,ezplot}, @ref{XREFezmesh,,ezmesh}, @ref{XREFezmeshc,,ezmeshc}, @ref{XREFshading,,shading}}
@end deftypefn
@node Three-dimensional Geometric Shapes
@subsubsection Three-dimensional Geometric Shapes
@c cylinder scripts/plot/draw/cylinder.m
@anchor{XREFcylinder}
@deftypefn {Command} {} cylinder
@deftypefnx {Function File} {} cylinder (@var{r})
@deftypefnx {Function File} {} cylinder (@var{r}, @var{n})
@deftypefnx {Function File} {} cylinder (@var{hax}, @dots{})
@deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} cylinder (@dots{})
Plot a 3-D unit cylinder.
The optional input @var{r} is a vector specifying the radius along the
unit z-axis. The default is [1 1] indicating radius 1 at @code{Z == 0}
and at @code{Z == 1}.
The optional input @var{n} determines the number of faces around the
the circumference of the cylinder. The default value is 20.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
If outputs are requested @code{cylinder} returns three matrices in
@code{meshgrid} format, such that @code{surf (@var{x}, @var{y}, @var{z})}
generates a unit cylinder.
Example:
@example
@group
[x, y, z] = cylinder (10:-1:0, 50);
surf (x, y, z);
title ("a cone");
@end group
@end example
@seealso{@ref{XREFellipsoid,,ellipsoid}, @ref{XREFrectangle,,rectangle}, @ref{XREFsphere,,sphere}}
@end deftypefn
@c sphere scripts/plot/draw/sphere.m
@anchor{XREFsphere}
@deftypefn {Function File} {} sphere ()
@deftypefnx {Function File} {} sphere (@var{n})
@deftypefnx {Function File} {} sphere (@var{hax}, @dots{})
@deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} sphere (@dots{})
Plot a 3-D unit sphere.
The optional input @var{n} determines the number of faces around the
the circumference of the sphere. The default value is 20.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
If outputs are requested @code{sphere} returns three matrices in
@code{meshgrid} format such that @code{surf (@var{x}, @var{y}, @var{z})}
generates a unit sphere.
Example:
@example
@group
[x, y, z] = sphere (40);
surf (3*x, 3*y, 3*z);
axis equal;
title ("sphere of radius 3");
@end group
@end example
@seealso{@ref{XREFcylinder,,cylinder}, @ref{XREFellipsoid,,ellipsoid}, @ref{XREFrectangle,,rectangle}}
@end deftypefn
@c ellipsoid scripts/plot/draw/ellipsoid.m
@anchor{XREFellipsoid}
@deftypefn {Function File} {} ellipsoid (@var{xc}, @var{yc}, @var{zc}, @var{xr}, @var{yr}, @var{zr}, @var{n})
@deftypefnx {Function File} {} ellipsoid (@dots{}, @var{n})
@deftypefnx {Function File} {} ellipsoid (@var{hax}, @dots{})
@deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} ellipsoid (@dots{})
Plot a 3-D ellipsoid.
The inputs @var{xc}, @var{yc}, @var{zc} specify the center of the ellipsoid.
The inputs @var{xr}, @var{yr}, @var{zr} specify the semi-major axis lengths.
The optional input @var{n} determines the number of faces around the
the circumference of the cylinder. The default value is 20.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
If outputs are requested @code{ellipsoid} returns three matrices in
@code{meshgrid} format, such that @code{surf (@var{x}, @var{y}, @var{z})}
generates the ellipsoid.
@seealso{@ref{XREFcylinder,,cylinder}, @ref{XREFrectangle,,rectangle}, @ref{XREFsphere,,sphere}}
@end deftypefn
@node Plot Annotations
@subsection Plot Annotations
You can add titles, axis labels, legends, and arbitrary text to an
existing plot. For example:
@example
@group
x = -10:0.1:10;
plot (x, sin (x));
title ("sin(x) for x = -10:0.1:10");
xlabel ("x");
ylabel ("sin (x)");
text (pi, 0.7, "arbitrary text");
legend ("sin (x)");
@end group
@end example
The functions @code{grid} and @code{box} may also be used to add grid
and border lines to the plot. By default, the grid is off and the
border lines are on.
@c title scripts/plot/appearance/title.m
@anchor{XREFtitle}
@deftypefn {Function File} {} title (@var{string})
@deftypefnx {Function File} {} title (@var{string}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} title (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} title (@dots{})
Specify the string used as a title for the current axis.
An optional list of @var{property}/@var{value} pairs can be used to change
the appearance of the created title text object.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created text
object.
@seealso{@ref{XREFxlabel,,xlabel}, @ref{XREFylabel,,ylabel}, @ref{XREFzlabel,,zlabel}, @ref{XREFtext,,text}}
@end deftypefn
@c legend scripts/plot/appearance/legend.m
@anchor{XREFlegend}
@deftypefn {Function File} {} legend (@var{str1}, @var{str2}, @dots{})
@deftypefnx {Function File} {} legend (@var{matstr})
@deftypefnx {Function File} {} legend (@var{cellstr})
@deftypefnx {Function File} {} legend (@dots{}, "location", @var{pos})
@deftypefnx {Function File} {} legend (@dots{}, "orientation", @var{orient})
@deftypefnx {Function File} {} legend (@var{hax}, @dots{})
@deftypefnx {Function File} {} legend (@var{hobjs}, @dots{})
@deftypefnx {Function File} {} legend (@var{hax}, @var{hobjs}, @dots{})
@deftypefnx {Function File} {} legend ("@var{option}")
@deftypefnx {Function File} {[@var{hleg}, @var{hleg_obj}, @var{hplot}, @var{labels}] =} legend (@dots{})
Display a legend for the current axes using the specified strings as labels.
Legend entries may be specified as individual character string arguments,
a character array, or a cell array of character strings.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}. If the handles,
@var{hobjs}, are not specified then the legend's strings will be associated
with the axes' descendants. @code{legend} works on line graphs,
bar graphs, etc. A plot must exist before legend is called.
The optional parameter @var{pos} specifies the location of the legend
as follows:
@multitable @columnfractions 0.06 0.14 0.80
@headitem @tab pos @tab location of the legend
@item @tab north @tab center top
@item @tab south @tab center bottom
@item @tab east @tab right center
@item @tab west @tab left center
@item @tab northeast @tab right top (default)
@item @tab northwest @tab left top
@item @tab southeast @tab right bottom
@item @tab southwest @tab left bottom
@item
@item @tab outside @tab can be appended to any location string
@end multitable
The optional parameter @var{orient} determines if the key elements
are placed vertically or horizontally. The allowed values are
@qcode{"vertical"} (default) or @qcode{"horizontal"}.
The following customizations are available using @var{option}:
@table @asis
@item @qcode{"show"}
Show legend on the plot
@item @qcode{"hide"}
Hide legend on the plot
@item @qcode{"toggle"}
Toggles between @qcode{"hide"} and @qcode{"show"}
@item @qcode{"boxon"}
Show a box around legend (default)
@item @qcode{"boxoff"}
Hide the box around legend
@item @qcode{"right"}
Place label text to the right of the keys (default)
@item @qcode{"left"}
Place label text to the left of the keys
@item @qcode{"off"}
Delete the legend object
@end table
The optional output values are
@table @var
@item hleg
The graphics handle of the legend object.
@item hleg_obj
Graphics handles to the text and line objects which make up the legend.
@item hplot
Graphics handles to the plot objects which were used in making the legend.
@item labels
A cell array of strings of the labels in the legend.
@end table
The legend label text is either provided in the call to @code{legend} or
is taken from the DisplayName property of graphics objects. If no
labels or DisplayNames are available, then the label text is simply
@qcode{"data1"}, @qcode{"data2"}, @dots{}, @nospell{@qcode{"dataN"}}.
Implementation Note: A legend is implemented as an additional axes object
of the current figure with the @qcode{"tag"} set to @qcode{"legend"}.
Properties of the legend object may be manipulated directly by using
@code{set}.
@end deftypefn
@c text scripts/plot/appearance/text.m
@anchor{XREFtext}
@deftypefn {Function File} {} text (@var{x}, @var{y}, @var{string})
@deftypefnx {Function File} {} text (@var{x}, @var{y}, @var{z}, @var{string})
@deftypefnx {Function File} {} text (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {@var{h} =} text (@dots{})
Create a text object with text @var{string} at position @var{x}, @var{y},
(@var{z}) on the current axes.
Multiple locations can be specified if @var{x}, @var{y}, (@var{z}) are
vectors. Multiple strings can be specified with a character matrix or
a cell array of strings.
Optional property/value pairs may be used to control the appearance of the
text.
The optional return value @var{h} is a vector of graphics handles to the
created text objects.
@seealso{@ref{XREFgtext,,gtext}, @ref{XREFtitle,,title}, @ref{XREFxlabel,,xlabel}, @ref{XREFylabel,,ylabel}, @ref{XREFzlabel,,zlabel}}
@end deftypefn
See @ref{Text Properties} for the properties that you can set.
@anchor{XREFylabel}
@anchor{XREFzlabel}
@c xlabel scripts/plot/appearance/xlabel.m
@anchor{XREFxlabel}
@deftypefn {Function File} {} xlabel (@var{string})
@deftypefnx {Function File} {} xlabel (@var{string}, @var{property}, @var{val}, @dots{})
@deftypefnx {Function File} {} xlabel (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} xlabel (@dots{})
Specify the string used to label the x-axis of the current axis.
An optional list of @var{property}/@var{value} pairs can be used to change
the properties of the created text label.
If the first argument @var{hax} is an axes handle, then operate on
this axis rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created text
object.
@seealso{@ref{XREFylabel,,ylabel}, @ref{XREFzlabel,,zlabel}, @ref{XREFdatetick,,datetick}, @ref{XREFtitle,,title}, @ref{XREFtext,,text}}
@end deftypefn
@c clabel scripts/plot/appearance/clabel.m
@anchor{XREFclabel}
@deftypefn {Function File} {} clabel (@var{c}, @var{h})
@deftypefnx {Function File} {} clabel (@var{c}, @var{h}, @var{v})
@deftypefnx {Function File} {} clabel (@var{c}, @var{h}, "manual")
@deftypefnx {Function File} {} clabel (@var{c})
@deftypefnx {Function File} {} clabel (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {@var{h} =} clabel (@dots{})
Add labels to the contours of a contour plot.
The contour levels are specified by the contour matrix @var{c} which is
returned by @code{contour}, @code{contourc}, @code{contourf}, and
@code{contour3}. Contour labels are rotated to match the local line
orientation and centered on the line. The position of labels along the
contour line is chosen randomly.
If the argument @var{h} is a handle to a contour group object, then label
this plot rather than the one in the current axes returned by @code{gca}.
By default, all contours are labeled. However, the contours to label can be
specified by the vector @var{v}. If the @qcode{"manual"} argument is
given then the contours to label can be selected with the mouse.
Additional property/value pairs that are valid properties of text objects
can be given and are passed to the underlying text objects. Moreover,
the contour group property @qcode{"LabelSpacing"} is available which
determines the spacing between labels on a contour to be specified. The
default is 144 points, or 2 inches.
The optional return value @var{h} is a vector of graphics handles to
the text objects representing each label.
The @qcode{"userdata"} property of the text objects contains the numerical
value of the contour label.
An example of the use of @code{clabel} is
@example
@group
[c, h] = contour (peaks (), -4 : 6);
clabel (c, h, -4:2:6, "fontsize", 12);
@end group
@end example
@seealso{@ref{XREFcontour,,contour}, @ref{XREFcontourf,,contourf}, @ref{XREFcontour3,,contour3}, @ref{XREFmeshc,,meshc}, @ref{XREFsurfc,,surfc}, @ref{XREFtext,,text}}
@end deftypefn
@c box scripts/plot/appearance/box.m
@anchor{XREFbox}
@deftypefn {Command} {} box on
@deftypefnx {Command} {} box off
@deftypefnx {Command} {} box
@deftypefnx {Function File} {} box (@var{hax}, @dots{})
Control display of the axis border.
The argument may be either @qcode{"on"} or @qcode{"off"}. If it is
omitted, the current box state is toggled.
If the first argument @var{hax} is an axes handle, then operate on
this axis rather than the current axes returned by @code{gca}.
@seealso{@ref{XREFaxis,,axis}, @ref{XREFgrid,,grid}}
@end deftypefn
@c grid scripts/plot/appearance/grid.m
@anchor{XREFgrid}
@deftypefn {Command} {} grid
@deftypefnx {Command} {} grid on
@deftypefnx {Command} {} grid off
@deftypefnx {Command} {} grid minor
@deftypefnx {Command} {} grid minor on
@deftypefnx {Command} {} grid minor off
@deftypefnx {Function File} {} grid (@var{hax}, @dots{})
Control the display of plot grid lines.
The function state input may be either @qcode{"on"} or @qcode{"off"}.
If it is omitted, the current grid state is toggled.
When the first argument is @qcode{"minor"} all subsequent commands
modify the minor grid rather than the major grid.
If the first argument @var{hax} is an axes handle, then operate on
this axis rather than the current axes returned by @code{gca}.
To control the grid lines for an individual axis use the @code{set}
function. For example:
@example
set (gca, "ygrid", "on");
@end example
@seealso{@ref{XREFaxis,,axis}, @ref{XREFbox,,box}}
@end deftypefn
@c colorbar scripts/plot/draw/colorbar.m
@anchor{XREFcolorbar}
@deftypefn {Command} {} colorbar
@deftypefnx {Function File} {} colorbar (@var{loc})
@deftypefnx {Function File} {} colorbar (@var{delete_option})
@deftypefnx {Function File} {} colorbar (@var{hcb}, @dots{})
@deftypefnx {Function File} {} colorbar (@var{hax}, @dots{})
@deftypefnx {Function File} {} colorbar (@dots{}, "peer", @var{hax}, @dots{})
@deftypefnx {Function File} {} colorbar (@dots{}, "location", @var{loc}, @dots{})
@deftypefnx {Function File} {} colorbar (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {@var{h} =} colorbar (@dots{})
Add a colorbar to the current axes.
A colorbar displays the current colormap along with numerical rulings
so that the color scale can be interpreted.
The optional input @var{loc} determines the location of the colorbar.
Valid values for @var{loc} are
@table @asis
@item @qcode{"EastOutside"}
Place the colorbar outside the plot to the right. This is the default.
@item @qcode{"East"}
Place the colorbar inside the plot to the right.
@item @qcode{"WestOutside"}
Place the colorbar outside the plot to the left.
@item @qcode{"West"}
Place the colorbar inside the plot to the left.
@item @qcode{"NorthOutside"}
Place the colorbar above the plot.
@item @qcode{"North"}
Place the colorbar at the top of the plot.
@item @qcode{"SouthOutside"}
Place the colorbar under the plot.
@item @qcode{"South"}
Place the colorbar at the bottom of the plot.
@end table
To remove a colorbar from a plot use any one of the following keywords for
the @var{delete_option}: @qcode{"delete"}, @qcode{"hide"}, @qcode{"off"}.
If the argument @qcode{"peer"} is given, then the following argument is
treated as the axes handle in which to add the colorbar. Alternatively,
If the first argument @var{hax} is an axes handle, then the colorbar is
added to this axis, rather than the current axes returned by @code{gca}.
If the first argument @var{hcb} is a handle to a colorbar object, then
operate on this colorbar directly.
Additional property/value pairs are passed directly to the underlying axes
object.
The optional return value @var{h} is a graphics handle to the created
colorbar object.
Implementation Note: A colorbar is created as an additional axes to the
current figure with the @qcode{"tag"} property set to @qcode{"colorbar"}.
The created axes object has the extra property @qcode{"location"} which
controls the positioning of the colorbar.
@seealso{@ref{XREFcolormap,,colormap}}
@end deftypefn
@node Multiple Plots on One Page
@subsection Multiple Plots on One Page
@cindex plotting, multiple plots per figure
Octave can display more than one plot in a single figure. The simplest
way to do this is to use the @code{subplot} function to divide the plot
area into a series of subplot windows that are indexed by an integer.
For example,
@example
@group
subplot (2, 1, 1)
fplot (@@sin, [-10, 10]);
subplot (2, 1, 2)
fplot (@@cos, [-10, 10]);
@end group
@end example
@noindent
creates a figure with two separate axes, one displaying a sine wave and
the other a cosine wave. The first call to subplot divides the figure
into two plotting areas (two rows and one column) and makes the first plot
area active. The grid of plot areas created by @code{subplot} is
numbered in column-major order (top to bottom, left to right).
@c subplot scripts/plot/util/subplot.m
@anchor{XREFsubplot}
@deftypefn {Function File} {} subplot (@var{rows}, @var{cols}, @var{index})
@deftypefnx {Function File} {} subplot (@var{rcn})
@deftypefnx {Function File} {} subplot (@var{hax})
@deftypefnx {Function File} {} subplot (@dots{}, "align")
@deftypefnx {Function File} {} subplot (@dots{}, "replace")
@deftypefnx {Function File} {} subplot (@dots{}, "position", @var{pos})
@deftypefnx {Function File} {} subplot (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {@var{hax} =} subplot (@dots{})
Set up a plot grid with @var{rows} by @var{cols} subwindows and set the
current axes for plotting (@code{gca}) to the location given by @var{index}.
If only one numeric argument is supplied, then it must be a three digit
value specifying the number of rows in digit 1, the number of
columns in digit 2, and the plot index in digit 3.
The plot index runs row-wise; First, all columns in a row are numbered
and then the next row is filled.
For example, a plot with 2x3 grid will have plot indices running as follows:
@tex
\vskip 10pt
\hfil\vbox{\offinterlineskip\hrule
\halign{\vrule#&&\qquad\hfil#\hfil\qquad\vrule\cr
height13pt&1&2&3\cr height12pt&&&\cr\noalign{\hrule}
height13pt&4&5&6\cr height12pt&&&\cr\noalign{\hrule}}}
\hfil
\vskip 10pt
@end tex
@ifnottex
@example
@group
+-----+-----+-----+
| 1 | 2 | 3 |
+-----+-----+-----+
| 4 | 5 | 6 |
+-----+-----+-----+
@end group
@end example
@end ifnottex
@var{index} may also be a vector. In this case, the new axis will enclose
the grid locations specified. The first demo illustrates this:
@example
demo ("subplot", 1)
@end example
The index of the subplot to make active may also be specified by its axes
handle, @var{hax}, returned from a previous @code{subplot} command.
If the option @qcode{"align"} is given then the plot boxes of the subwindows
will align, but this may leave no room for axis tick marks or labels.
If the option @qcode{"replace"} is given then the subplot axis will be
reset, rather than just switching the current axis for plotting to the
requested subplot.
The @qcode{"position"} property can be used to exactly position the subplot
axes within the current figure. The option @var{pos} is a 4-element vector
[x, y, width, height] that determines the location and size of the axes.
The values in @var{pos} are normalized in the range [0,1].
Any property/value pairs are passed directly to the underlying axes object.
If the output @var{hax} is requested, subplot returns the axis handle for
the subplot. This is useful for modifying the properties of a subplot
using @code{set}.
@seealso{@ref{XREFaxes,,axes}, @ref{XREFplot,,plot}, @ref{XREFgca,,gca}, @ref{XREFset,,set}}
@end deftypefn
@node Multiple Plot Windows
@subsection Multiple Plot Windows
@cindex plotting, multiple plot windows
You can open multiple plot windows using the @code{figure} function.
For example,
@example
@group
figure (1);
fplot (@@sin, [-10, 10]);
figure (2);
fplot (@@cos, [-10, 10]);
@end group
@end example
@noindent
creates two figures, with the first displaying a sine wave and
the second a cosine wave. Figure numbers must be positive integers.
@c figure scripts/plot/util/figure.m
@anchor{XREFfigure}
@deftypefn {Command} {} figure
@deftypefnx {Command} {} figure @var{n}
@deftypefnx {Function File} {} figure (@var{n})
@deftypefnx {Function File} {} figure (@dots{}, "@var{property}", @var{value}, @dots{})
@deftypefnx {Function File} {@var{h} =} figure (@dots{})
Create a new figure window for plotting.
If no arguments are specified, a new figure with the next available number
is created.
If called with an integer @var{n}, and no such numbered figure exists, then
a new figure with the specified number is created. If the figure already
exists then it is made visible and becomes the current figure for plotting.
Multiple property-value pairs may be specified for the figure object, but
they must appear in pairs.
The optional return value @var{h} is a graphics handle to the created figure
object.
@seealso{@ref{XREFaxes,,axes}, @ref{XREFgcf,,gcf}, @ref{XREFclf,,clf}, @ref{XREFclose,,close}}
@end deftypefn
@node Manipulation of Plot Windows
@subsection Manipulation of Plot Windows
@cindex plotting, window manipulation
By default, Octave refreshes the plot window when a prompt is printed,
or when waiting for input. The
@code{drawnow} function is used to cause a plot window to be updated.
@c drawnow libinterp/corefcn/graphics.cc
@anchor{XREFdrawnow}
@deftypefn {Built-in Function} {} drawnow ()
@deftypefnx {Built-in Function} {} drawnow ("expose")
@deftypefnx {Built-in Function} {} drawnow (@var{term}, @var{file}, @var{mono}, @var{debug_file})
Update figure windows and their children. The event queue is flushed and
any callbacks generated are executed. With the optional argument
@qcode{"expose"}, only graphic objects are updated and no other events or
callbacks are processed.
The third calling form of @code{drawnow} is for debugging and is
undocumented.
@end deftypefn
Only figures that are modified will be updated. The @code{refresh}
function can also be used to force an update of the current figure, even if
it is not modified.
@c refresh scripts/plot/util/refresh.m
@anchor{XREFrefresh}
@deftypefn {Function File} {} refresh ()
@deftypefnx {Function File} {} refresh (@var{h})
Refresh a figure, forcing it to be redrawn.
When called without an argument the current figure is redrawn. Otherwise,
the figure with graphic handle @var{h} is redrawn.
@seealso{@ref{XREFdrawnow,,drawnow}}
@end deftypefn
Normally, high-level plot functions like @code{plot} or @code{mesh} call
@code{newplot} to initialize the state of the current axes so that the
next plot is drawn in a blank window with default property settings. To
have two plots superimposed over one another, use the @code{hold}
function. For example,
@example
@group
hold on;
x = -10:0.1:10;
plot (x, sin (x));
plot (x, cos (x));
hold off;
@end group
@end example
@noindent
displays sine and cosine waves on the same axes. If the hold state is
off, consecutive plotting commands like this will only display the last
plot.
@c newplot scripts/plot/util/newplot.m
@anchor{XREFnewplot}
@deftypefn {Function File} {} newplot ()
@deftypefnx {Function File} {} newplot (@var{hfig})
@deftypefnx {Function File} {} newplot (@var{hax})
@deftypefnx {Function File} {@var{hax} =} newplot (@dots{})
Prepare graphics engine to produce a new plot.
This function is called at the beginning of all high-level plotting
functions. It is not normally required in user programs. @code{newplot}
queries the @qcode{"NextPlot"} field of the current figure and axis to
determine what to do.
@multitable @columnfractions .25 .75
@headitem Figure NextPlot @tab Action
@item @qcode{"new"} @tab Create a new figure and make it the current figure.
@item @qcode{"add"} (default) @tab Add new graphic objects to the current figure.
@item @qcode{"replacechildren"} @tab Delete child objects whose HandleVisibility is
set to @qcode{"on"}. Set NextPlot property to @qcode{"add"}. This
typically clears a figure, but leaves in place hidden objects such as
menubars. This is equivalent to @code{clf}.
@item @qcode{"replace"} @tab Delete all child objects of the figure and
reset all figure properties to their defaults. However, the following
four properties are not reset: Position, Units, PaperPosition, PaperUnits.
This is equivalent to @code{clf reset}.
@end multitable
@multitable @columnfractions .25 .75
@headitem Axis NextPlot @tab Action
@item @qcode{"add"} @tab Add new graphic objects to the current axes. This is
equivalent to @code{hold on}.
@item @qcode{"replacechildren"} @tab Delete child objects whose HandleVisibility is
set to @qcode{"on"}, but leave axis properties unmodified. This typically
clears a plot, but preserves special settings such as log scaling for
axes. This is equivalent to @code{cla}.
@item @qcode{"replace"} (default) @tab Delete all child objects of the
axis and reset all axis properties to their defaults. However, the
following properties are not reset: Position, Units. This is equivalent
to @code{cla reset}.
@end multitable
If the optional input @var{hfig} or @var{hax} is given then prepare the
specified figure or axes rather than the current figure and axes.
The optional return value @var{hax} is a graphics handle to the created
axes object (not figure).
@strong{Caution:} Calling @code{newplot} may change the current figure and
current axis.
@end deftypefn
@c hold scripts/plot/util/hold.m
@anchor{XREFhold}
@deftypefn {Command} {} hold
@deftypefnx {Command} {} hold on
@deftypefnx {Command} {} hold off
@deftypefnx {Command} {} hold all
@deftypefnx {Function File} {} hold (@var{hax}, @dots{})
Toggle or set the @qcode{"hold"} state of the plotting engine which
determines whether new graphic objects are added to the plot or replace
the existing objects.
@table @code
@item hold on
Retain plot data and settings so that subsequent plot commands are displayed
on a single graph.
@item hold all
Retain plot line color, line style, data, and settings so that subsequent
plot commands are displayed on a single graph with the next line color and
style.
@item hold off
Restore default graphics settings which clear the graph and reset axis
properties before each new plot command. (default).
@item hold
Toggle the current hold state.
@end table
When given the additional argument @var{hax}, the hold state is modified
for this axis rather than the current axes returned by @code{gca}.
To query the current hold state use the @code{ishold} function.
@seealso{@ref{XREFishold,,ishold}, @ref{XREFcla,,cla}, @ref{XREFclf,,clf}, @ref{XREFnewplot,,newplot}}
@end deftypefn
@c ishold scripts/plot/util/ishold.m
@anchor{XREFishold}
@deftypefn {Command} {} ishold
@deftypefnx {Function File} {} ishold (@var{hax})
@deftypefnx {Function File} {} ishold (@var{hfig})
Return true if the next plot will be added to the current plot, or
false if the plot device will be cleared before drawing the next plot.
If the first argument is an axes handle @var{hax} or figure handle
@var{hfig} then operate on this plot rather than the current one.
@seealso{@ref{XREFhold,,hold}, @ref{XREFnewplot,,newplot}}
@end deftypefn
To clear the current figure, call the @code{clf} function. To clear the
current axis, call the @code{cla} function. To bring the current figure
to the top of the window stack, call the @code{shg} function. To delete
a graphics object, call @code{delete} on its index. To close the
figure window, call the @code{close} function.
@c clf scripts/plot/util/clf.m
@anchor{XREFclf}
@deftypefn {Command} {} clf
@deftypefnx {Command} {} clf reset
@deftypefnx {Function File} {} clf (@var{hfig})
@deftypefnx {Function File} {} clf (@var{hfig}, "reset")
@deftypefnx {Function File} {@var{h} =} clf (@dots{})
Clear the current figure window.
@code{clf} operates by deleting child graphics objects with visible
handles (HandleVisibility = @qcode{"on"}).
If the optional argument @qcode{"reset"} is specified, delete all child
objects including those with hidden handles and reset all figure
properties to their defaults. However, the following properties are not
reset: Position, Units, PaperPosition, PaperUnits.
If the first argument @var{hfig} is a figure handle, then operate on
this figure rather than the current figure returned by @code{gcf}.
The optional return value @var{h} is the graphics handle of the figure
window that was cleared.
@seealso{@ref{XREFcla,,cla}, @ref{XREFclose,,close}, @ref{XREFdelete,,delete}, @ref{XREFreset,,reset}}
@end deftypefn
@c cla scripts/plot/util/cla.m
@anchor{XREFcla}
@deftypefn {Command} {} cla
@deftypefnx {Command} {} cla reset
@deftypefnx {Function File} {} cla (@var{hax})
@deftypefnx {Function File} {} cla (@var{hax}, "reset")
Clear the current axes.
@code{cla} operates by deleting child graphic objects with visible
handles (HandleVisibility = @qcode{"on"}).
If the optional argument @qcode{"reset"} is specified, delete all child
objects including those with hidden handles and reset all axis properties
to their defaults. However, the following properties are not reset:
Position, Units.
If the first argument @var{hax} is an axes handle, then operate on
this axis rather than the current axes returned by @code{gca}.
@seealso{@ref{XREFclf,,clf}, @ref{XREFdelete,,delete}, @ref{XREFreset,,reset}}
@end deftypefn
@c shg scripts/plot/util/shg.m
@anchor{XREFshg}
@deftypefn {Command} {} shg
Show the graph window.
Currently, this is the same as executing @code{drawnow}.
@seealso{@ref{XREFdrawnow,,drawnow}, @ref{XREFfigure,,figure}}
@end deftypefn
@c delete scripts/miscellaneous/delete.m
@anchor{XREFdelete}
@deftypefn {Function File} {} delete (@var{file})
@deftypefnx {Function File} {} delete (@var{handle})
Delete the named file or graphics handle.
Deleting graphics objects is the proper way to remove
features from a plot without clearing the entire figure.
@seealso{@ref{XREFclf,,clf}, @ref{XREFcla,,cla}, @ref{XREFunlink,,unlink}}
@end deftypefn
@c close scripts/plot/util/close.m
@anchor{XREFclose}
@deftypefn {Command} {} close
@deftypefnx {Command} {} close (@var{h})
@deftypefnx {Command} {} close all
@deftypefnx {Command} {} close all hidden
Close figure window(s).
When called with no arguments, close the current figure. This is equivalent
to @code{close (gcf)}. If the input @var{h} is a graphic handle, or vector
of graphics handles, then close each figure in @var{h}.
If the argument @qcode{"all"} is given then all figures with visible handles
(HandleVisibility = @qcode{"on"}) are closed.
If the argument @qcode{"all hidden"} is given then all figures, including
hidden ones, are closed.
Implementation Note: @code{close} operates by calling the function specified
by the @qcode{"closerequestfcn"} property for each figure. By default, the
function @code{closereq} is used. It is possible that the function invoked
will delay or abort removing the figure. To remove a figure without
executing any callback functions use @code{delete}. When writing a callback
function to close a window do not use @code{close} to avoid recursion.
@seealso{@ref{XREFclosereq,,closereq}, @ref{XREFdelete,,delete}}
@end deftypefn
@c closereq scripts/plot/util/closereq.m
@anchor{XREFclosereq}
@deftypefn {Function File} {} closereq ()
Close the current figure and delete all graphics objects associated with it.
By default, the @qcode{"closerequestfcn"} property of a new plot figure
points to this function.
@seealso{@ref{XREFclose,,close}, @ref{XREFdelete,,delete}}
@end deftypefn
@node Use of the @code{interpreter} Property
@subsection Use of the @code{interpreter} Property
All text objects---such as titles, labels, legends, and text---include
the property @qcode{"interpreter"}, this property determines the manner in
which special control sequences in the text are rendered. If the interpreter
is set to @qcode{"none"}, then no rendering occurs. Currently the
@qcode{"latex"} interpreter is not implemented and is equivalent to
@qcode{"none"}.
The @qcode{"tex"} option implements a subset of @TeX{} functionality when
rendering text. This allows the insertion of special glyphs such as Greek
characters or mathematical symbols. The special characters are inserted with
a code following a backslash (\) character, as in the table
@ref{tab:extended}.
In addition, the formatting of the text can be changed within the string
by using the codes
@multitable @columnfractions .2 .2 .6 .2
@item @tab \bf @tab Bold font @tab
@item @tab \it @tab Italic font @tab
@item @tab \sl @tab Oblique Font @tab
@item @tab \rm @tab Normal font @tab
@end multitable
These may be used in conjunction with the @{ and @} characters to limit
the change in the font to part of the string. For example,
@example
xlabel ('@{\bf H@} = a @{\bf V@}')
@end example
@noindent
where the character @qcode{'a'} will not appear in a bold font. Note that to
avoid having Octave interpret the backslash characters in the strings,
the strings should be in single quotes.
It is also possible to change the fontname and size within the text
@multitable @columnfractions .1 .4 .6 .1
@item @tab \fontname@{@var{fontname}@} @tab Specify the font to use @tab
@item @tab \fontsize@{@var{size}@} @tab Specify the size of the font to
use @tab
@end multitable
Finally, superscripting and subscripting can be controlled with the @qcode{'^'}
and @qcode{'_'} characters. If the @qcode{'^'} or @qcode{'_'} is followed by a
@{ character, then all of the block surrounded by the @{ @} pair is super- or
sub-scripted. Without the @{ @} pair, only the character immediately following
the @qcode{'^'} or @qcode{'_'} is super- or sub-scripted.
@float Table,tab:extended
@tex
\vskip 6pt
\newdimen\cola \cola=78pt
\newdimen\colb \colb=78pt
\newdimen\colc \colc=78pt
\def\symtable#1#2#3{
\hbox to \hsize {\hfill\vbox{\offinterlineskip \tabskip=0pt
\hskip36pt #1
\vskip6pt
\halign{
\vrule height2.0ex depth1.ex width 0.6pt #2\tabskip=0.3em &
#2 \hfil & \vrule #2 & #2 \hfil & #2 \vrule &
#2 \hfil & \vrule #2 & #2 \hfil & #2 \vrule &
#2 \hfil & \vrule #2 & #2 \hfil & #2 \vrule
width 0.6pt \tabskip=0pt\cr
\noalign{\hrule height 0.6pt}
& Code && Sym && Code && Sym && Code && Sym &\cr
\noalign{\hrule}
#3
\noalign{\hrule height 0.6pt}
}
}\hfill}}
\hoffset72pt
\symtable{Greek Lowercase Letters} {#}
{& \hbox to \cola{$\backslash$alpha } && $\alpha$
&& \hbox to \colb{$\backslash$beta } && $\beta$
&& \hbox to \colc{$\backslash$gamma} && $\gamma$ &\cr
& $\backslash$delta && $\delta$
&& $\backslash$epsilon && $\epsilon$
&& $\backslash$zeta && $\zeta$ &\cr
& $\backslash$eta && $\eta$
&& $\backslash$theta && $\theta$
&& $\backslash$vartheta && $\vartheta$ &\cr
& $\backslash$iota && $\iota$
&& $\backslash$kappa && $\kappa$
&& $\backslash$lambda && $\lambda$ &\cr
& $\backslash$mu && $\mu$
&& $\backslash$nu && $\nu$
&& $\backslash$xi && $\xi$ &\cr
& $\backslash$o && $o$
&& $\backslash$pi && $\pi$
&& $\backslash$varpi && $\varpi$ &\cr
& $\backslash$rho && $\rho$
&& $\backslash$sigma && $\sigma$
&& $\backslash$varsigma && $\varsigma$ &\cr
& $\backslash$tau && $\tau$
&& $\backslash$upsilon && $\upsilon$
&& $\backslash$phi && $\phi$ &\cr
& $\backslash$chi && $\chi$
&& $\backslash$psi && $\psi$
&& $\backslash$omega && $\omega$ &\cr}
\vskip12pt
\symtable{Greek Uppercase Letters} {#}
{& \hbox to \cola{$\backslash$Gamma} && $\Gamma$
&& \hbox to \colb{$\backslash$Delta} && $\Delta$
&& \hbox to \colc{$\backslash$Theta} && $\Theta$ &\cr
& $\backslash$Lambda && $\Lambda$
&& $\backslash$Xi && $\Xi$
&& $\backslash$Pi && $\Pi$ &\cr
& $\backslash$Sigma && $\Sigma$
&& $\backslash$Upsilon && $\Upsilon$
&& $\backslash$Phi && $\Phi$ &\cr
& $\backslash$Psi && $\Psi$
&& $\backslash$Omega && $\Omega$
&& && &\cr}
\vskip12pt
\symtable{Misc Symbols Type Ord} {#}
{& \hbox to \cola{$\backslash$aleph} && $\aleph$
&& \hbox to \colb{$\backslash$wp} && $\wp$
&& \hbox to \colc{$\backslash$Re} && $\Re$ &\cr
& $\backslash$Im && $\Im$
&& $\backslash$partial && $\partial$
&& $\backslash$infty && $\infty$ &\cr
& $\backslash$prime && $\prime$
&& $\backslash$nabla && $\nabla$
&& $\backslash$surd && $\surd$ &\cr
& $\backslash$angle && $\angle$
&& $\backslash$forall && $\forall$
&& $\backslash$exists && $\exists$ &\cr
& $\backslash$neg && $\neg$
&& $\backslash$clubsuit && $\clubsuit$
&& $\backslash$diamondsuit && $\diamondsuit$ &\cr
& $\backslash$heartsuit && $\heartsuit$
&& $\backslash$spadesuit && $\spadesuit$
&& && &\cr}
\vskip12pt
\symtable{``Large'' Operators} {#}
{& \hbox to \cola{$\backslash$int} && $\int$
&& \hbox to \colb{} &&
&& \hbox to \colc{} && &\cr}
\vskip12pt
\symtable{Binary operators} {#}
{& \hbox to \cola{$\backslash$pm} && $\pm$
&& \hbox to \colb{$\backslash$cdot} && $\cdot$
&& \hbox to \colc{$\backslash$times} && $\times$ &\cr
& $\backslash$ast && $\ast$
&& $\backslash$circ && $\circ$
&& $\backslash$bullet && $\bullet$ &\cr
& $\backslash$div && $\div$
&& $\backslash$cap && $\cap$
&& $\backslash$cup && $\cup$ &\cr
& $\backslash$vee && $\vee$
&& $\backslash$wedge && $\wedge$
&& $\backslash$oplus && $\oplus$ &\cr
& $\backslash$otimes && $\otimes$
&& $\backslash$oslash && $\oslash$
&& && &\cr}
@end tex
@ifnottex
@multitable @columnfractions .25 .25 .25 .25
@item Greek Lowercase Letters
@item @tab \alpha @tab \beta @tab \gamma
@item @tab \delta @tab \epsilon @tab \zeta
@item @tab \eta @tab \theta @tab \vartheta
@item @tab \iota @tab \kappa @tab \lambda
@item @tab \mu @tab \nu @tab \xi
@item @tab \o @tab \pi @tab \varpi
@item @tab \rho @tab \sigma @tab \varsigma
@item @tab \tau @tab \upsilon @tab \phi
@item @tab \chi @tab \psi @tab \omega
@item Greek Uppercase Letters
@item @tab \Gamma @tab \Delta @tab \Theta
@item @tab \Lambda @tab \Xi @tab \Pi
@item @tab \Sigma @tab \Upsilon @tab \Phi
@item @tab \Psi @tab \Omega @tab
@item Misc Symbols Type Ord
@item @tab \aleph @tab \wp @tab \Re
@item @tab \Im @tab \partial @tab \infty
@item @tab \prime @tab \nabla @tab \surd
@item @tab \angle @tab \forall @tab \exists
@item @tab \neg @tab \clubsuit @tab \diamondsuit
@item @tab \heartsuit @tab \spadesuit @tab
@item ``Large'' Operators
@item @tab \int
@item Binary Operators
@item @tab \pm @tab \cdot @tab \times
@item @tab \ast @tab \circ @tab \bullet
@item @tab \div @tab \cap @tab \cup
@item @tab \vee @tab \wedge @tab \oplus
@item @tab \otimes @tab \oslash @tab
@item Relations
@item @tab \leq @tab \subset @tab \subseteq
@item @tab \in @tab \geq @tab \supset
@item @tab \supseteq @tab \ni @tab \mid
@item @tab \equiv @tab \sim @tab \approx
@item @tab \cong @tab \propto @tab \perp
@item Arrows
@item @tab \leftarrow @tab \Leftarrow @tab \rightarrow
@item @tab \Rightarrow @tab \leftrightarrow @tab \uparrow
@item @tab \downarrow @tab @tab
@item Openings and Closings
@item @tab \lfloor @tab \langle @tab \lceil
@item @tab \rfloor @tab \rangle @tab \rceil
@item Alternate Names
@item @tab \neq
@item Other
@item @tab \ldots @tab \0 @tab \copyright
@item @tab \deg
@end multitable
@end ifnottex
@caption{Available special characters in @TeX{} mode}
@end float
@float
@tex
\vskip 6pt
\newdimen\cola \cola=78pt
\newdimen\colb \colb=78pt
\newdimen\colc \colc=78pt
\def\symtable#1#2#3{\hbox to \hsize {\hfill\vbox{\offinterlineskip \tabskip=0pt
\hskip36pt #1
\vskip6pt
\halign{
\vrule height2.0ex depth1.ex width 0.6pt #2\tabskip=0.3em &
#2 \hfil & \vrule #2 & #2 \hfil & #2 \vrule &
#2 \hfil & \vrule #2 & #2 \hfil & #2 \vrule &
#2 \hfil & \vrule #2 & #2 \hfil & #2 \vrule
width 0.6pt \tabskip=0pt\cr
\noalign{\hrule height 0.6pt}
& Code && Sym && Code && Sym && Code && Sym &\cr
\noalign{\hrule}
#3
\noalign{\hrule height 0.6pt}
}
}\hfill}}
\hoffset72pt
\vskip12pt
\symtable{Relations} {#}
{& \hbox to \cola{$\backslash$leq} && $\leq$
&& \hbox to \colb{$\backslash$subset} && $\subset$
&& \hbox to \colc{$\backslash$subseteq} && $\subseteq$ &\cr
& $\backslash$in && $\in$
&& $\backslash$geq && $\geq$
&& $\backslash$supset && $\supset$ &\cr
& $\backslash$supseteq && $\supseteq$
&& $\backslash$ni && $\ni$
&& $\backslash$mid && $\mid$ &\cr
& $\backslash$equiv && $\equiv$
&& $\backslash$sim && $\sim$
&& $\backslash$approx && $\approx$ &\cr
& $\backslash$cong && $\cong$
&& $\backslash$propto && $\propto$
&& $\backslash$perp && $\perp$ &\cr}
\vskip12pt
\symtable{Arrows} {#}
{& \hbox to \cola{$\backslash$leftarrow} && $\leftarrow$
&& \hbox to \colb{$\backslash$Leftarrow} && $\Leftarrow$
&& \hbox to \colc{$\backslash$rightarrow} && $\rightarrow$ &\cr
& $\backslash$Rightarrow && $\Rightarrow$
&& $\backslash$leftrightarrow && $\leftrightarrow$
&& $\backslash$uparrow && $\uparrow$ &\cr
& $\backslash$downarrow && $\downarrow$
&& &&
&& && &\cr}
\vskip12pt
\symtable{Openings and Closings} {#}
{& \hbox to \cola{$\backslash$lfloor } && $\lfloor$
&& \hbox to \colb{$\backslash$langle } && $\langle$
&& \hbox to \colc{$\backslash$lceil } && $\lceil$ &\cr
& $\backslash$rfloor && $\rfloor$
&& $\backslash$rangle && $\rangle$
&& $\backslash$rceil && $\rceil$ &\cr}
\vskip12pt
\symtable{Alternate Names} {#}
{& \hbox to \cola{$\backslash$neq} && $\neq$
&& \hbox to \colb{} &&
&& \hbox to \colc{} && &\cr}
\vskip12pt
\symtable{Other (not in Appendix F Tables)} {#}
{& \hbox to \cola{$\backslash$ldots} && $\ldots$
&& \hbox to \colb{$\backslash$0} && $\oslash$
&& \hbox to \colc{$\backslash$copyright} && $\copyright$ &\cr
& $\backslash$deg && $^\circ$
&& &&
&& && &\cr}
\vskip12pt
\hskip36pt Table 15.1: Available special characters in \TeX\ mode (cont.)
@end tex
@end float
A complete example showing the capabilities of the extended text is
@example
@group
x = 0:0.01:3;
plot (x, erf (x));
hold on;
plot (x,x,"r");
axis ([0, 3, 0, 1]);
text (0.65, 0.6175, strcat ('\leftarrow x = @{2/\surd\pi',
' @{\fontsize@{16@}\int_@{\fontsize@{8@}0@}^@{\fontsize@{8@}x@}@}',
' e^@{-t^2@} dt@} = 0.6175'))
@end group
@end example
@ifnotinfo
@noindent
The result of which can be seen in @ref{fig:extendedtext}
@float Figure,fig:extendedtext
@center @image{extended,4in}
@caption{Example of inclusion of text with the @TeX{} interpreter}
@end float
@end ifnotinfo
@node Printing and Saving Plots
@subsection Printing and Saving Plots
@cindex plotting, saving and printing plots
@cindex printing plots
@cindex saving plots
The @code{print} command allows you to send plots to you printer and
to save plots in a variety of formats. For example,
@example
print -dpsc
@end example
@noindent
prints the current figure to a color PostScript printer. And,
@example
print -deps foo.eps
@end example
@noindent
saves the current figure to an encapsulated PostScript file called
@file{foo.eps}.
@c print scripts/plot/util/print.m
@anchor{XREFprint}
@deftypefn {Function File} {} print ()
@deftypefnx {Function File} {} print (@var{options})
@deftypefnx {Function File} {} print (@var{filename}, @var{options})
@deftypefnx {Function File} {} print (@var{h}, @var{filename}, @var{options})
Print a plot, or save it to a file.
Both output formatted for printing (PDF and PostScript), and many bitmapped
and vector image formats are supported.
@var{filename} defines the name of the output file. If the
file name has no suffix, one is inferred from the specified
device and appended to the file name. If no filename is
specified, the output is sent to the printer.
@var{h} specifies the handle of the figure to print. If no handle is
specified the current figure is used.
For output to a printer, PostScript file, or PDF file,
the paper size is specified by the figure's @code{papersize}
property. The location and size of the image on the page are
specified by the figure's @code{paperposition} property. The
orientation of the page is specified by the figure's
@code{paperorientation} property.
The width and height of images are specified by the figure's
@code{paperpositon(3:4)} property values.
The @code{print} command supports many @var{options}:
@table @code
@item -f@var{h}
Specify the handle, @var{h}, of the figure to be printed. The
default is the current figure.
@item -P@var{printer}
Set the @var{printer} name to which the plot is sent if no
@var{filename} is specified.
@item -G@var{ghostscript_command}
Specify the command for calling Ghostscript. For Unix and Windows
the defaults are @qcode{"gs"} and @qcode{"gswin32c"}, respectively.
@item -color
@itemx -mono
Color or monochrome output.
@item -solid
@itemx -dashed
Force all lines to be solid or dashed, respectively.
@item -portrait
@itemx -landscape
Specify the orientation of the plot for printed output. For
non-printed output the aspect ratio of the output corresponds to
the plot area defined by the @qcode{"paperposition"} property in the
orientation specified. This option is equivalent to changing
the figure's @qcode{"paperorientation"} property.
@item -TextAlphaBits=@var{n}
@itemx -GraphicsAlphaBits=@var{n}
Octave is able to produce output for various printers, bitmaps, and
vector formats by using Ghostscript.
For bitmap and printer output anti-aliasing is applied using
Ghostscript's TextAlphaBits and GraphicsAlphaBits options.
The default number of bits for each is 4.
Allowed values for @var{N} are 1, 2, or 4.
@item -d@var{device}
The available output format is specified by the option @var{device},
and is one of:
@table @code
@item ps
@itemx ps2
@itemx psc
@itemx psc2
PostScript (level 1 and 2, mono and color). The FLTK graphics
toolkit generates PostScript level 3.0.
@item eps
@itemx eps2
@itemx epsc
@itemx epsc2
Encapsulated PostScript (level 1 and 2, mono and color). The FLTK
graphic toolkit generates PostScript level 3.0.
@item tex
@itemx epslatex
@itemx epslatexstandalone
@itemx pstex
@itemx pslatex
@itemx pdflatex
Generate a @LaTeX{} (or @TeX{}) file for labels and eps/ps/pdf
for graphics. The file produced by @code{epslatexstandalone} can be
processed directly by @LaTeX{}. The other formats are intended to
be included in a @LaTeX{} (or @TeX{}) document. The @code{tex} device
is the same as the @code{epslatex} device. The @code{pdflatex} device
is only available for the FLTK graphics toolkit.
@item tikz
Generate a @LaTeX{} file using PGF/TikZ@. For the FLTK toolkit
the result is PGF.
@item ill
@itemx aifm
Adobe Illustrator (Obsolete for Gnuplot versions > 4.2)
@item cdr
@itemx @nospell{corel}
CorelDraw
@item dxf
AutoCAD
@item emf
@itemx meta
Microsoft Enhanced Metafile
@item fig
XFig. For the Gnuplot graphics toolkit, the additional options
@option{-textspecial} or @option{-textnormal} can be used to control
whether the special flag should be set for the text in
the figure. (default is @option{-textnormal})
@item hpgl
HP plotter language
@item mf
Metafont
@item png
Portable network graphics
@item jpg
@itemx jpeg
JPEG image
@item gif
GIF image (only available for the Gnuplot graphics toolkit)
@item pbm
PBMplus
@item svg
Scalable vector graphics
@item pdf
Portable document format
@end table
If the device is omitted, it is inferred from the file extension,
or if there is no filename it is sent to the printer as PostScript.
@item -d@var{ghostscript_device}
Additional devices are supported by Ghostscript.
Some examples are;
@table @code
@item ljet2p
HP LaserJet @nospell{IIP}
@item ljet3
HP LaserJet III
@item deskjet
HP DeskJet and DeskJet Plus
@item cdj550
HP DeskJet 550C
@item paintjet
HP PointJet
@item pcx24b
24-bit color PCX file format
@item ppm
Portable Pixel Map file format
@item pdfwrite
Produces pdf output from eps
@end table
For a complete list, type @code{system ("gs -h")} to see what formats
and devices are available.
When Ghostscript output is sent to a printer the size is determined
by the figure's @qcode{"papersize"} property. When the output
is sent to a file the size is determined by the plot box defined by
the figure's @qcode{"paperposition"} property.
@item -append
Append PostScript or PDF output to a pre-existing file of the same type.
@item -r@var{NUM}
Resolution of bitmaps in pixels per inch. For both metafiles and
SVG the default is the screen resolution; for other formats it is 150 dpi.
To specify screen resolution, use @qcode{"-r0"}.
@item -loose
@itemx -tight
Force a tight or loose bounding box for eps files. The default is loose.
@item -@var{preview}
Add a preview to eps files. Supported formats are:
@table @code
@item -interchange
Provide an interchange preview.
@item -metalfile
Provide a metafile preview.
@item -pict
Provide pict preview.
@item -tiff
Provide a tiff preview.
@end table
@item -S@var{xsize},@var{ysize}
Plot size in pixels for EMF, GIF, JPEG, PBM, PNG, and SVG@. For
PS, EPS, PDF, and other vector formats the plot size is in points.
This option is equivalent to changing the size of the plot box
associated with the @qcode{"paperposition"} property. When using the
command form of the print function you must quote the
@var{xsize},@var{ysize} option. For example, by writing @w{"-S640,480"}.
@item -F@var{fontname}
@itemx -F@var{fontname}:@var{size}
@itemx -F:@var{size}
Use @var{fontname} and/or @var{fontsize} for all text.
@var{fontname} is ignored for some devices: dxf, fig, hpgl, etc.
@end table
The filename and options can be given in any order.
Example: Print to a file using the svg device.
@example
@group
figure (1);
clf ();
surf (peaks);
print -dsvg figure1.svg
@end group
@end example
Example: Print to an HP DeskJet 550C.
@example
@group
clf ();
surf (peaks);
print -dcdj550
@end group
@end example
@seealso{@ref{XREFsaveas,,saveas}, @ref{XREForient,,orient}, @ref{XREFfigure,,figure}}
@end deftypefn
@c saveas scripts/plot/util/saveas.m
@anchor{XREFsaveas}
@deftypefn {Function File} {} saveas (@var{h}, @var{filename})
@deftypefnx {Function File} {} saveas (@var{h}, @var{filename}, @var{fmt})
Save graphic object @var{h} to the file @var{filename} in graphic
format @var{fmt}.
@var{fmt} should be one of the following formats:
@table @code
@item ps
PostScript
@item eps
Encapsulated PostScript
@item jpg
JPEG Image
@item png
PNG Image
@item emf
Enhanced Meta File
@item pdf
Portable Document Format
@end table
All device formats specified in @code{print} may also be used. If
@var{fmt} is omitted it is extracted from the extension of @var{filename}.
The default format is @qcode{"pdf"}.
@example
@group
clf ();
surf (peaks);
saveas (1, "figure1.png");
@end group
@end example
@seealso{@ref{XREFprint,,print}, @ref{XREForient,,orient}}
@end deftypefn
@c orient scripts/plot/appearance/orient.m
@anchor{XREForient}
@deftypefn {Function File} {} orient (@var{orientation})
@deftypefnx {Function File} {} orient (@var{hfig}, @var{orientation})
@deftypefnx {Function File} {@var{orientation} =} orient ()
@deftypefnx {Function File} {@var{orientation} =} orient (@var{hfig})
Query or set the print orientation for figure @var{hfig}.
Valid values for @var{orientation} are @qcode{"portrait"},
@qcode{"landscape"}, and @qcode{"tall"}.
The @qcode{"landscape"} option changes the orientation so the plot width
is larger than the plot height. The @qcode{"paperposition"} is also
modified so that the plot fills the page, while leaving a 0.25 inch border.
The @qcode{"tall"} option sets the orientation to @qcode{"portrait"} and
fills the page with the plot, while leaving a 0.25 inch border.
The @qcode{"portrait"} option (default) changes the orientation so the plot
height is larger than the plot width. It also restores the default
@qcode{"paperposition"} property.
When called with no arguments, return the current print orientation.
If the argument @var{hfig} is omitted, then operate on the current figure
returned by @code{gcf}.
@seealso{@ref{XREFprint,,print}, @ref{XREFsaveas,,saveas}}
@end deftypefn
@node Interacting with Plots
@subsection Interacting with Plots
The user can select points on a plot with the @code{ginput} function or
selection the position at which to place text on the plot with the
@code{gtext} function using the mouse. Menus may also be created
and populated with specific user commands via the @code{uimenu} function.
@c ginput scripts/plot/util/ginput.m
@anchor{XREFginput}
@deftypefn {Function File} {[@var{x}, @var{y}, @var{buttons}] =} ginput (@var{n})
@deftypefnx {Function File} {[@var{x}, @var{y}, @var{buttons}] =} ginput ()
Return the position and type of mouse button clicks and/or key strokes
in the current figure window.
If @var{n} is defined, then capture @var{n} events before returning.
When @var{n} is not defined @code{ginput} will loop until the return key
@key{RET} is pressed.
The return values @var{x}, @var{y} are the coordinates where the mouse
was clicked in the units of the current axes. The return value @var{button}
is 1, 2, or 3 for the left, middle, or right button. If a key is pressed
the ASCII value is returned in @var{button}.
@seealso{@ref{XREFgtext,,gtext}, @ref{XREFwaitforbuttonpress,,waitforbuttonpress}}
@end deftypefn
@c waitforbuttonpress scripts/gui/waitforbuttonpress.m
@anchor{XREFwaitforbuttonpress}
@deftypefn {Function File} {} waitforbuttonpress ()
@deftypefnx {Function File} {@var{b} =} waitforbuttonpress ()
Wait for mouse click or key press over the current figure window.
The return value of @var{b} is 0 if a mouse button was pressed or 1 if a
key was pressed.
@seealso{@ref{XREFwaitfor,,waitfor}, @ref{XREFginput,,ginput}, @ref{XREFkbhit,,kbhit}}
@end deftypefn
@c gtext scripts/plot/appearance/gtext.m
@anchor{XREFgtext}
@deftypefn {Function File} {} gtext (@var{s})
@deftypefnx {Function File} {} gtext (@{@var{s1}, @var{s2}, @dots{}@})
@deftypefnx {Function File} {} gtext (@{@var{s1}; @var{s2}; @dots{}@})
@deftypefnx {Function File} {} gtext (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {@var{h} =} gtext (@dots{})
Place text on the current figure using the mouse.
The text is defined by the string @var{s}. If @var{s} is a cell string
organized as a row vector then each string of the cell array is written to a
separate line. If @var{s} is organized as a column vector then one string
element of the cell array is placed for every mouse click.
Optional property/value pairs are passed directly to the underlying text
objects.
The optional return value @var{h} is a graphics handle to the created
text object(s).
@seealso{@ref{XREFginput,,ginput}, @ref{XREFtext,,text}}
@end deftypefn
@c uimenu scripts/gui/uimenu.m
@anchor{XREFuimenu}
@deftypefn {Function File} {} uimenu (@var{property}, @var{value}, @dots{})
@deftypefnx {Function File} {} uimenu (@var{h}, @var{property}, @var{value}, @dots{})
Create a uimenu object and return a handle to it. If @var{h} is omitted
then a top-level menu for the current figure is created. If @var{h}
is given then a submenu relative to @var{h} is created.
uimenu objects have the following specific properties:
@table @asis
@item @qcode{"accelerator"}
A string containing the key combination together with CTRL to execute this
menu entry (e.g., @qcode{"x"} for CTRL+x).
@item @qcode{"callback"}
Is the function called when this menu entry is executed. It can be either a
function string (e.g., @qcode{"myfun"}), a function handle (e.g., @@myfun)
or a cell array containing the function handle and arguments for the
callback function (e.g., @{@@myfun, arg1, arg2@}).
@item @qcode{"checked"}
Can be set @qcode{"on"} or @qcode{"off"}. Sets a mark at this menu entry.
@item @qcode{"enable"}
Can be set @qcode{"on"} or @qcode{"off"}. If disabled the menu entry
cannot be selected and it is grayed out.
@item @qcode{"foregroundcolor"}
A color value setting the text color for this menu entry.
@item @qcode{"label"}
A string containing the label for this menu entry. A @qcode{"&"}-symbol
can be used to mark the @qcode{"accelerator"} character (e.g.,
@nospell{@qcode{"E&xit"}})
@item @qcode{"position"}
An scalar value containing the relative menu position. The entry with the
lowest value is at the first position starting from left or top.
@item @qcode{"separator"}
Can be set @qcode{"on"} or @qcode{"off"}. If enabled it draws a separator
line above the current position. It is ignored for top level entries.
@end table
Examples:
@example
@group
f = uimenu ("label", "&File", "accelerator", "f");
e = uimenu ("label", "&Edit", "accelerator", "e");
uimenu (f, "label", "Close", "accelerator", "q", ...
"callback", "close (gcf)");
uimenu (e, "label", "Toggle &Grid", "accelerator", "g", ...
"callback", "grid (gca)");
@end group
@end example
@seealso{@ref{XREFfigure,,figure}}
@end deftypefn
@node Test Plotting Functions
@subsection Test Plotting Functions
The functions @code{sombrero} and @code{peaks} provide a way to check
that plotting is working. Typing either @code{sombrero} or @code{peaks}
at the Octave prompt should display a three-dimensional plot.
@c sombrero scripts/plot/draw/sombrero.m
@anchor{XREFsombrero}
@deftypefn {Function File} {} sombrero ()
@deftypefnx {Function File} {} sombrero (@var{n})
@deftypefnx {Function File} {@var{z} =} sombrero (@dots{})
@deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} sombrero (@dots{})
Plot the familiar 3-D sombrero function.
The function plotted is
@tex
$$z = { \rm{sin} (\sqrt {(x^2 + y^2)}) \over \sqrt {(x^2 + y^2)} }$$
@end tex
@ifnottex
@example
z = sin (sqrt (x^2 + y^2)) / (sqrt (x^2 + y^2))
@end example
@end ifnottex
Called without a return argument, @code{sombrero} plots the surface of the
above function over the meshgrid [-8,8] using @code{surf}.
If @var{n} is a scalar the plot is made with @var{n} grid lines.
The default value for @var{n} is 41.
When called with output arguments, return the data for the function
evaluated over the meshgrid. This can subsequently be plotted with
@code{surf (@var{x}, @var{y}, @var{z})}.
@seealso{@ref{XREFpeaks,,peaks}, @ref{XREFmeshgrid,,meshgrid}, @ref{XREFmesh,,mesh}, @ref{XREFsurf,,surf}}
@end deftypefn
@c peaks scripts/plot/draw/peaks.m
@anchor{XREFpeaks}
@deftypefn {Function File} {} peaks ()
@deftypefnx {Function File} {} peaks (@var{n})
@deftypefnx {Function File} {} peaks (@var{x}, @var{y})
@deftypefnx {Function File} {@var{z} =} peaks (@dots{})
@deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} peaks (@dots{})
Plot a function with lots of local maxima and minima.
The function has the form
@tex
$$f(x,y) = 3 (1 - x) ^ 2 e ^ {\left(-x^2 - (y+1)^2\right)} - 10 \left({x \over 5} - x^3 - y^5)\right) - {1 \over 3} e^{\left(-(x+1)^2 - y^2\right)}$$
@end tex
@ifnottex
@verbatim
f(x,y) = 3*(1-x)^2*exp(-x^2 - (y+1)^2) ...
- 10*(x/5 - x^3 - y^5)*exp(-x^2-y^2) ...
- 1/3*exp(-(x+1)^2 - y^2)
@end verbatim
@end ifnottex
Called without a return argument, @code{peaks} plots the surface of the
above function using @code{surf}.
If @var{n} is a scalar, @code{peaks} plots the value of the above
function on an @var{n}-by-@var{n} mesh over the range [-3,3]. The
default value for @var{n} is 49.
If @var{n} is a vector, then it represents the grid values over which
to calculate the function. If @var{x} and @var{y} are specified then
the function value is calculated over the specified grid of vertices.
When called with output arguments, return the data for the function
evaluated over the meshgrid. This can subsequently be plotted with
@code{surf (@var{x}, @var{y}, @var{z})}.
@seealso{@ref{XREFsombrero,,sombrero}, @ref{XREFmeshgrid,,meshgrid}, @ref{XREFmesh,,mesh}, @ref{XREFsurf,,surf}}
@end deftypefn
@node Graphics Data Structures
@section Graphics Data Structures
@cindex graphics data structures
@menu
* Introduction to Graphics Structures::
* Graphics Objects::
* Graphics Object Properties::
* Searching Properties::
* Managing Default Properties::
@end menu
@node Introduction to Graphics Structures
@subsection Introduction to Graphics Structures
@cindex introduction to graphics structures
@anchor{XREFgraphics structures}
The graphics functions use pointers, which are of class graphics_handle, in
order to address the data structures which control graphical displays. A
graphics handle may point any one of a number of different object types. The
objects are the graphics data structures. The types of objects are:
@code{figure}, @code{axes}, @code{line}, @code{text}, @code{patch},
@code{surface}, @code{text} and @code{image}.
Each of these objects has a function by the same name. and, each of these
functions returns a graphics handle pointing to an object of corresponding
type. In addition there are several functions which operate on properties of
the graphics objects and which return handles: the functions @code{ plot} and
@code{plot3} return a handle pointing to an object of type line, the function
@code{subplot} returns a handle pointing to an object of type axes, the
function @code{fill} returns a handle pointing to an object of type patch, the
functions @code{area}, @code{bar}, @code{barh}, @code{contour},
@code{contourf}, @code{contour3}, @code{surf}, @code{mesh}, @code{surfc},
@code{meshc}, @code{errorbar}, @code{quiver}, @code{quiver3}, @code{scatter},
@code{scatter3}, @code{stair}, @code{stem}, @code{stem3} each return a handle
as documented in @ref{XREFdatasources,,Data Sources}.
The graphics objects are arranged in a hierarchy:
1. The root is at 0. i.e., @code{get (0)} returns the properties of the root
object.
2. Below the root are @code{figure} objects.
3. Below the @code{figure} objects are @code{axes}.
4. Below the @code{axes} objects are
@code{line}, @code{text}, @code{patch},
@code{surface}, and @code{image} objects.
Graphics handles may be distinguished from function handles
(@pxref{Function Handles}) by means of the function @code{ishandle}.
@code{ishandle} returns true if its argument is a handle of a graphics object.
In addition, the figure object may be tested using @code{isfigure}.
@code{isfigure} returns true only if its argument is a handle of a figure. The
@code{whos} function can be used to show the object type of each currently
defined graphics handle. (Note: this is not true today, but it is, I hope,
considered an error in whos. It may be better to have whos just show
graphics_handle as the class, and provide a new function which, given a
graphics handle, returns its object type. This could generalize the ishandle()
functions and, in fact, replace them.)
The @code{get} and @code{set} commands are used to obtain and set the values of
properties of graphics objects. In addition, the @code{get} command may be
used to obtain property names.
For example, the property @qcode{"type"} of the graphics object pointed to by
the graphics handle h may be displayed by:
@example
get (h, "type")
@end example
The properties and their current values are returned by @code{get (h)}
where h is a handle of a graphics object. If only the names of the
allowed properties are wanted they may be displayed by:
@code{get (h, "")}.
Thus, for example:
@smallexample
h = figure ();
get (h, "type")
ans = figure
get (h, "");
error: get: ambiguous figure property name ; possible matches:
__enhanced__ hittest resize
__graphics_toolkit__ integerhandle resizefcn
__guidata__ interruptible selected
__modified__ inverthardcopy selectionhighlight
__myhandle__ keypressfcn selectiontype
__plot_stream__ keyreleasefcn tag
alphamap menubar toolbar
beingdeleted mincolormap type
busyaction name uicontextmenu
buttondownfcn nextplot units
children numbertitle userdata
clipping outerposition visible
closerequestfcn paperorientation windowbuttondownfcn
color paperposition windowbuttonmotionfcn
colormap paperpositionmode windowbuttonupfcn
createfcn papersize windowkeypressfcn
currentaxes papertype windowkeyreleasefcn
currentcharacter paperunits windowscrollwheelfcn
currentobject parent windowstyle
currentpoint pointer wvisual
deletefcn pointershapecdata wvisualmode
dockcontrols pointershapehotspot xdisplay
doublebuffer position xvisual
filename renderer xvisualmode
handlevisibility renderermode
@end smallexample
The root figure has index 0. Its properties may be displayed by:
@code{get (0, "")}.
The uses of @code{get} and @code{set} are further explained in
@ref{XREFget,,get}, @ref{XREFset,,set}.
@c isprop scripts/plot/util/isprop.m
@anchor{XREFisprop}
@deftypefn {Function File} {@var{res} =} isprop (@var{h}, "@var{prop}")
Return true if @var{prop} is a property of the object with handle @var{h}.
@var{h} may also be an array of handles in which case @var{res} will be a
logical array indicating whether each handle has the property @var{prop}.
@seealso{@ref{XREFget,,get}, @ref{XREFset,,set}, @ref{XREFismethod,,ismethod}, @ref{XREFisobject,,isobject}}
@end deftypefn
@node Graphics Objects
@subsection Graphics Objects
@cindex graphics objects
The hierarchy of graphics objects was explained above.
@xref{Introduction to Graphics Structures}. Here the
specific objects are described, and the properties contained in
these objects are discussed. Keep in mind that
graphics objects are always referenced by @dfn{handle}.
@table @asis
@c @group
@item root figure
@cindex root figure graphics object
@cindex graphics object, root figure
the top level of the hierarchy and the parent of all figure objects.
The handle index of the root figure is 0.
@item figure
@cindex figure graphics object
@cindex graphics object, figure
A figure window.
@item axes
@cindex axes graphics object
@cindex graphics object, axes
A set of axes. This object is a child of a figure object and may be a
parent of line, text, image, patch, or surface objects.
@item line
@cindex line graphics object
@cindex graphics object, line
A line in two or three dimensions.
@item text
@cindex text graphics object
@cindex graphics object, text
Text annotations.
@item image
@cindex image graphics object
@cindex graphics object, image
A bitmap image.
@item patch
@cindex patch graphics object
@cindex graphics object, patch
A filled polygon, currently limited to two dimensions.
@item surface
@cindex surface graphics object
@cindex graphics object, surface
A three-dimensional surface.
@c @end group
@end table
@subsubsection Creating Graphics Objects
@cindex creating graphics objects
You can create axes, line, patch, and surface objects directly using the
@code{axes}, @code{line}, @code{patch}, @code{fill}, and @code{surface}
functions. These objects become children of the current axes object.
@c axes scripts/plot/util/axes.m
@anchor{XREFaxes}
@deftypefn {Function File} {} axes ()
@deftypefnx {Function File} {} axes (@var{property}, @var{value}, @dots{})
@deftypefnx {Function File} {} axes (@var{hax})
@deftypefnx {Function File} {@var{h} =} axes (@dots{})
Create an axes object and return a handle to it, or set the current
axes to @var{hax}.
Called without any arguments, or with @var{property}/@var{value} pairs,
construct a new axes. For accepted properties and corresponding
values, @pxref{XREFset,,set}.
Called with a single axes handle argument @var{hax}, the function makes
@var{hax} the current axis. It also restacks the axes in the
corresponding figure so that @var{hax} is the first entry in the list
of children. This causes @var{hax} to be displayed on top of any other
axes objects (Z-order stacking).
@seealso {gca, set, get}
@end deftypefn
@c line scripts/plot/draw/line.m
@anchor{XREFline}
@deftypefn {Function File} {} line ()
@deftypefnx {Function File} {} line (@var{x}, @var{y})
@deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{property}, @var{value}, @dots{})
@deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} line (@var{x}, @var{y}, @var{z}, @var{property}, @var{value}, @dots{})
@deftypefnx {Function File} {} line (@var{property}, @var{value}, @dots{})
@deftypefnx {Function File} {} line (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} line (@dots{})
Create line object from @var{x} and @var{y} (and possibly @var{z}) and
insert in the current axes.
Multiple property-value pairs may be specified for the line object, but they
must appear in pairs.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle (or vector of handles)
to the line objects created.
@seealso{@ref{XREFimage,,image}, @ref{XREFpatch,,patch}, @ref{XREFrectangle,,rectangle}, @ref{XREFsurface,,surface}, @ref{XREFtext,,text}}
@end deftypefn
@c patch scripts/plot/draw/patch.m
@anchor{XREFpatch}
@deftypefn {Function File} {} patch ()
@deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{c})
@deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{z}, @var{c})
@deftypefnx {Function File} {} patch (@var{fv})
@deftypefnx {Function File} {} patch ("Faces", @var{faces}, "Vertices", @var{verts}, @dots{})
@deftypefnx {Function File} {} patch (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} patch (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} patch (@dots{})
Create patch object in the current axes with vertices at locations
(@var{x}, @var{y}) and of color @var{c}.
If the vertices are matrices of size @nospell{MxN} then each polygon patch
has M vertices and a total of N polygons will be created. If some polygons
do not have M vertices use NaN to represent "no vertex". If the @var{z}
input is present then 3-D patches will be created.
The color argument @var{c} can take many forms. To create polygons
which all share a single color use a string value (e.g., @qcode{"r"} for
red), a scalar value which is scaled by @code{caxis} and indexed into the
current colormap, or a 3-element RGB vector with the precise TrueColor.
If @var{c} is a vector of length N then the ith polygon will have a color
determined by scaling entry @var{c}(i) according to @code{caxis} and then
indexing into the current colormap. More complicated coloring situations
require directly manipulating patch property/value pairs.
Instead of specifying polygons by matrices @var{x} and @var{y}, it is
possible to present a unique list of vertices and then a list of polygon
faces created from those vertices. In this case the
@qcode{"Vertices"} matrix will be an @nospell{Nx2} (2-D patch) or
@nospell{Nx3} (3-D path). The @nospell{MxN} @qcode{"Faces"} matrix
describes M polygons having N vertices---each row describes a
single polygon and each column entry is an index into the
@qcode{"Vertices"} matrix to identify a vertex. The patch object
can be created by directly passing the property/value pairs
@qcode{"Vertices"}/@var{verts}, @qcode{"Faces"}/@var{faces} as
inputs.
A third input form is to create a structure @var{fv} with the fields
@qcode{"vertices"}, @qcode{"faces"}, and optionally
@qcode{"facevertexcdata"}.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created patch
object.
Implementation Note: Patches are highly configurable objects. To truly
customize them requires setting patch properties directly. Useful patch
properties are: @qcode{"cdata"}, @qcode{"edgecolor"},
@qcode{"facecolor"}, @qcode{"faces"}, @qcode{"facevertexcdata"}.
@seealso{@ref{XREFfill,,fill}, @ref{XREFget,,get}, @ref{XREFset,,set}}
@end deftypefn
@c fill scripts/plot/draw/fill.m
@anchor{XREFfill}
@deftypefn {Function File} {} fill (@var{x}, @var{y}, @var{c})
@deftypefnx {Function File} {} fill (@var{x1}, @var{y1}, @var{c1}, @var{x2}, @var{y2}, @var{c2})
@deftypefnx {Function File} {} fill (@dots{}, @var{prop}, @var{val})
@deftypefnx {Function File} {} fill (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} fill (@dots{})
Create one or more filled 2-D polygons.
The inputs @var{x} and @var{y} are the coordinates of the polygon vertices.
If the inputs are matrices then the rows represent different vertices and
each column produces a different polygon. @code{fill} will close any open
polygons before plotting.
The input @var{c} determines the color of the polygon. The simplest form
is a single color specification such as a @code{plot} format or an
RGB-triple. In this case the polygon(s) will have one unique color. If
@var{c} is a vector or matrix then the color data is first scaled using
@code{caxis} and then indexed into the current colormap. A row vector will
color each polygon (a column from matrices @var{x} and @var{y}) with a
single computed color. A matrix @var{c} of the same size as @var{x} and
@var{y} will compute the color of each vertex and then interpolate the face
color between the vertices.
Multiple property/value pairs for the underlying patch object may be
specified, but they must appear in pairs.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a vector of graphics handles to
the created patch objects.
Example: red square
@example
@group
vertices = [0 0
1 0
1 1
0 1];
fill (vertices(:,1), vertices(:,2), "r");
axis ([-0.5 1.5, -0.5 1.5])
axis equal
@end group
@end example
@seealso{@ref{XREFpatch,,patch}, @ref{XREFcaxis,,caxis}, @ref{XREFcolormap,,colormap}}
@end deftypefn
@c surface scripts/plot/draw/surface.m
@anchor{XREFsurface}
@deftypefn {Function File} {} surface (@var{x}, @var{y}, @var{z}, @var{c})
@deftypefnx {Function File} {} surface (@var{x}, @var{y}, @var{z})
@deftypefnx {Function File} {} surface (@var{z}, @var{c})
@deftypefnx {Function File} {} surface (@var{z})
@deftypefnx {Function File} {} surface (@dots{}, @var{prop}, @var{val}, @dots{})
@deftypefnx {Function File} {} surface (@var{hax}, @dots{})
@deftypefnx {Function File} {@var{h} =} surface (@dots{})
Create a surface graphic object given matrices @var{x} and @var{y} from
@code{meshgrid} and a matrix of values @var{z} corresponding to the
@var{x} and @var{y} coordinates of the surface.
If @var{x} and @var{y} are vectors, then a typical vertex is
(@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, columns of @var{z} correspond
to different @var{x} values and rows of @var{z} correspond to different
@var{y} values. If only a single input @var{z} is given then @var{x} is
taken to be @code{1:rows (@var{z})} and @var{y} is
@code{1:columns (@var{z})}.
Any property/value input pairs are assigned to the surface object.
If the first argument @var{hax} is an axes handle, then plot into this axis,
rather than the current axes returned by @code{gca}.
The optional return value @var{h} is a graphics handle to the created
surface object.
@seealso{@ref{XREFsurf,,surf}, @ref{XREFmesh,,mesh}, @ref{XREFpatch,,patch}, @ref{XREFline,,line}}
@end deftypefn
@subsubsection Handle Functions
@cindex handle functions
To determine whether a variable is a graphics object index, or an index
to an axes or figure, use the functions @code{ishandle}, @code{isaxes}, and
@code{isfigure}.
@c ishandle libinterp/corefcn/graphics.cc
@anchor{XREFishandle}
@deftypefn {Built-in Function} {} ishandle (@var{h})
Return true if @var{h} is a graphics handle and false otherwise.
@var{h} may also be a matrix of handles in which case a logical
array is returned that is true where the elements of @var{h} are
graphics handles and false where they are not.
@seealso{@ref{XREFisaxes,,isaxes}, @ref{XREFisfigure,,isfigure}}
@end deftypefn
@c ishghandle scripts/plot/util/ishghandle.m
@anchor{XREFishghandle}
@deftypefn {Function File} {} ishghandle (@var{h})
Return true if @var{h} is a graphics handle and false otherwise.
This function is equivalent to @code{ishandle} and is provided for
compatibility with @sc{matlab}.
@seealso{@ref{XREFishandle,,ishandle}}
@end deftypefn
@c isaxes scripts/plot/util/isaxes.m
@anchor{XREFisaxes}
@deftypefn {Function File} {} isaxes (@var{h})
Return true if @var{h} is an axes graphics handle and false otherwise.
If @var{h} is a matrix then return a logical array which is true where
the elements of @var{h} are axes graphics handles and false where
they are not.
@seealso{@ref{XREFisaxes,,isaxes}, @ref{XREFishandle,,ishandle}}
@end deftypefn
@c isfigure scripts/plot/util/isfigure.m
@anchor{XREFisfigure}
@deftypefn {Function File} {} isfigure (@var{h})
Return true if @var{h} is a figure graphics handle and false otherwise.
If @var{h} is a matrix then return a logical array which is true where
the elements of @var{h} are figure graphics handles and false where
they are not.
@seealso{@ref{XREFisaxes,,isaxes}, @ref{XREFishandle,,ishandle}}
@end deftypefn
The function @code{gcf} returns an index to the current figure object,
or creates one if none exists. Similarly, @code{gca} returns the
current axes object, or creates one (and its parent figure object) if
none exists.
@c gcf scripts/plot/util/gcf.m
@anchor{XREFgcf}
@deftypefn {Function File} {@var{h} =} gcf ()
Return a handle to the current figure.
The current figure is the default target for graphics output. If multiple
figures exist, @code{gcf} returns the last created figure or the last figure
that was clicked on with the mouse.
If a current figure does not exist, create one and return its handle. The
handle may then be used to examine or set properties of the figure. For
example,
@example
@group
fplot (@@sin, [-10, 10]);
fig = gcf ();
set (fig, "numbertitle", "off", "name", "sin plot")
@end group
@end example
@noindent
plots a sine wave, finds the handle of the current figure, and then
renames the figure window to describe the contents.
Note: To find the current figure without creating a new one if it does not
exist, query the @qcode{"CurrentFigure"} property of the root graphics
object.
@example
get (0, "currentfigure");
@end example
@seealso{@ref{XREFgca,,gca}, @ref{XREFgco,,gco}, @ref{XREFgcbf,,gcbf}, @ref{XREFgcbo,,gcbo}, @ref{XREFget,,get}, @ref{XREFset,,set}}
@end deftypefn
@c gca scripts/plot/util/gca.m
@anchor{XREFgca}
@deftypefn {Function File} {@var{h} =} gca ()
Return a handle to the current axis object.
The current axis is the default target for graphics output. In the case
of a figure with multiple axes, @code{gca} returns the last created axes
or the last axes that was clicked on with the mouse.
If no current axes object exists, create one and return its handle. The
handle may then be used to examine or set properties of the axes. For
example,
@example
@group
ax = gca ();
set (ax, "position", [0.5, 0.5, 0.5, 0.5]);
@end group
@end example
@noindent
creates an empty axes object and then changes its location and size in the
figure window.
Note: To find the current axis without creating a new axes object if it
does not exist, query the @qcode{"CurrentAxes"} property of a figure.
@example
get (gcf, "currentaxes");
@end example
@seealso{@ref{XREFgcf,,gcf}, @ref{XREFgco,,gco}, @ref{XREFgcbf,,gcbf}, @ref{XREFgcbo,,gcbo}, @ref{XREFget,,get}, @ref{XREFset,,set}}
@end deftypefn
@c gco scripts/plot/util/gco.m
@anchor{XREFgco}
@deftypefn {Function File} {@var{h} =} gco ()
@deftypefnx {Function File} {@var{h} =} gco (@var{fig})
Return a handle to the current object of the current figure, or a handle
to the current object of the figure with handle @var{fig}.
The current object of a figure is the object that was last clicked on. It
is stored in the @qcode{"CurrentObject"} property of the target figure.
If the last mouse click did not occur on any child object of the figure,
then the current object is the figure itself.
If no mouse click occurred in the target figure, this function returns an
empty matrix.
Programming Note: The value returned by this function is not necessarily the
same as the one returned by @code{gcbo} during callback execution. An
executing callback can be interrupted by another callback and the current
object may be changed.
@seealso{@ref{XREFgcbo,,gcbo}, @ref{XREFgca,,gca}, @ref{XREFgcf,,gcf}, @ref{XREFgcbf,,gcbf}, @ref{XREFget,,get}, @ref{XREFset,,set}}
@end deftypefn
The @code{get} and @code{set} functions may be used to examine and set
properties for graphics objects. For example,
@example
@group
get (0)
@result{} ans =
@{
type = root
currentfigure = [](0x0)
children = [](0x0)
visible = on
@dots{}
@}
@end group
@end example
@noindent
returns a structure containing all the properties of the root figure.
As with all functions in Octave, the structure is returned by value, so
modifying it will not modify the internal root figure plot object. To
do that, you must use the @code{set} function. Also, note that in this
case, the @code{currentfigure} property is empty, which indicates that
there is no current figure window.
The @code{get} function may also be used to find the value of a single
property. For example,
@example
@group
get (gca (), "xlim")
@result{} [ 0 1 ]
@end group
@end example
@noindent
returns the range of the x-axis for the current axes object in the
current figure.
To set graphics object properties, use the set function. For example,
@example
set (gca (), "xlim", [-10, 10]);
@end example
@noindent
sets the range of the x-axis for the current axes object in the current
figure to @samp{[-10, 10]}. Additionally, calling set with a graphics
object index as the only argument returns a structure containing the
default values for all the properties for the given object type. For
example,
@example
set (gca ())
@end example
@noindent
returns a structure containing the default property values for axes
objects.
@c get libinterp/corefcn/graphics.cc
@anchor{XREFget}
@deftypefn {Built-in Function} {@var{val} =} get (@var{h})
@deftypefnx {Built-in Function} {@var{val} =} get (@var{h}, @var{p})
Return the value of the named property @var{p} from the graphics handle
@var{h}. If @var{p} is omitted, return the complete property list for
@var{h}. If @var{h} is a vector, return a cell array including the property
values or lists respectively.
@seealso{@ref{XREFset,,set}}
@end deftypefn
@c set libinterp/corefcn/graphics.cc
@anchor{XREFset}
@deftypefn {Built-in Function} {} set (@var{h}, @var{property}, @var{value}, @dots{})
@deftypefnx {Built-in Function} {} set (@var{h}, @var{properties}, @var{values})
@deftypefnx {Built-in Function} {} set (@var{h}, @var{pv})
Set named property values for the graphics handle (or vector of graphics
handles) @var{h}.
There are three ways how to give the property names and values:
@itemize
@item as a comma separated list of @var{property}, @var{value} pairs
Here, each @var{property} is a string containing the property name, each
@var{value} is a value of the appropriate type for the property.
@item as a cell array of strings @var{properties} containing property names
and a cell array @var{values} containing property values.
In this case, the number of columns of @var{values} must match the number of
elements in @var{properties}. The first column of @var{values} contains
values for the first entry in @var{properties}, etc. The number of rows of
@var{values} must be 1 or match the number of elements of @var{h}. In the
first case, each handle in @var{h} will be assigned the same values. In the
latter case, the first handle in @var{h} will be assigned the values from
the first row of @var{values} and so on.
@item as a structure array @var{pv}
Here, the field names of @var{pv} represent the property names, and the field
values give the property values. In contrast to the previous case, all
elements of @var{pv} will be set in all handles in @var{h} independent of
the dimensions of @var{pv}.
@end itemize
@seealso{@ref{XREFget,,get}}
@end deftypefn
@c ancestor scripts/plot/util/ancestor.m
@anchor{XREFancestor}
@deftypefn {Function File} {@var{parent} =} ancestor (@var{h}, @var{type})
@deftypefnx {Function File} {@var{parent} =} ancestor (@var{h}, @var{type}, "toplevel")
Return the first ancestor of handle object @var{h} whose type matches
@var{type}, where @var{type} is a character string. If @var{type} is a
cell array of strings, return the first parent whose type matches
any of the given type strings.
If the handle object @var{h} itself is of type @var{type}, return @var{h}.
If @qcode{"toplevel"} is given as a third argument, return the highest
parent in the object hierarchy that matches the condition, instead
of the first (nearest) one.
@seealso{@ref{XREFfindobj,,findobj}, @ref{XREFfindall,,findall}, @ref{XREFallchild,,allchild}}
@end deftypefn
@c allchild scripts/plot/util/allchild.m
@anchor{XREFallchild}
@deftypefn {Function File} {@var{h} =} allchild (@var{handles})
Find all children, including hidden children, of a graphics object.
This function is similar to @code{get (h, "children")}, but also returns
hidden objects (HandleVisibility = @qcode{"off"}). If @var{handles} is a
scalar, @var{h} will be a vector. Otherwise, @var{h} will be a cell
matrix of the same size as @var{handles} and each cell will contain a
vector of handles.
@seealso{@ref{XREFfindall,,findall}, @ref{XREFfindobj,,findobj}, @ref{XREFget,,get}, @ref{XREFset,,set}}
@end deftypefn
@c findfigs scripts/plot/util/findfigs.m
@anchor{XREFfindfigs}
@deftypefn {Function File} {} findfigs ()
Find all visible figures that are currently off the screen and move them
onto the screen.
@seealso{@ref{XREFallchild,,allchild}, @ref{XREFfigure,,figure}, @ref{XREFget,,get}, @ref{XREFset,,set}}
@end deftypefn
@cindex saving graphics objects
@cindex graphics objects, saving
Figures can be printed or saved in many graphics formats with @code{print} and
@code{saveas}. Occasionally, however, it may be useful to save the original
Octave handle graphic directly so that further modifications can be made such
as modifying a title or legend.
This can be accomplished with the following functions by
@example
@group
fig_struct = hdl2struct (gcf);
save myplot.fig -struct fig_struct;
@dots{}
fig_struct = load ("myplot.fig");
struct2hdl (fig_struct);
@end group
@end example
@c hdl2struct scripts/plot/util/hdl2struct.m
@anchor{XREFhdl2struct}
@deftypefn {Function File} {@var{s} =} hdl2struct (@var{h})
Return a structure, @var{s}, whose fields describe the properties
of the object, and its children, associated with the handle, @var{h}.
The fields of the structure @var{s} are @qcode{"type"}, @qcode{"handle"},
@qcode{"properties"}, @qcode{"children"}, and @qcode{"special"}.
@seealso{@ref{XREFstruct2hdl,,struct2hdl}, @ref{XREFfindobj,,findobj}}
@end deftypefn
@c struct2hdl scripts/plot/util/struct2hdl.m
@anchor{XREFstruct2hdl}
@deftypefn {Function File} {@var{h} =} struct2hdl (@var{s})
@deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p})
@deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p}, @var{hilev})
Construct a graphics handle object @var{h} from the structure @var{s}.
The structure must contain the fields @qcode{"handle"}, @qcode{"type"},
@qcode{"children"}, @qcode{"properties"}, and @qcode{"special"}. If the
handle of an existing figure or axes is specified, @var{p}, the new object
will be created as a child of that object. If no parent handle is provided
then a new figure and the necessary children will be constructed using the
default values from the root figure.
A third boolean argument @var{hilev} can be passed to specify whether
the function should preserve listeners/callbacks, e.g., for legends or
hggroups. The default is false.
@seealso{@ref{XREFhdl2struct,,hdl2struct}, @ref{XREFfindobj,,findobj}}
@end deftypefn
@c copyobj scripts/plot/util/copyobj.m
@anchor{XREFcopyobj}
@deftypefn {Function File} {@var{hnew} =} copyobj (@var{horig})
@deftypefnx {Function File} {@var{hnew} =} copyobj (@var{horig}, @var{hparent})
Construct a copy of the graphic object associated with handle @var{horig}
and return a handle @var{hnew} to the new object.
If a parent handle @var{hparent} (root, figure, axes, or hggroup) is
specified, the copied object will be created as a child of @var{hparent}.
@seealso{@ref{XREFstruct2hdl,,struct2hdl}, @ref{XREFhdl2struct,,hdl2struct}, @ref{XREFfindobj,,findobj}}
@end deftypefn
@node Graphics Object Properties
@subsection Graphics Object Properties
@cindex graphics object properties
@menu
* Root Figure Properties::
* Figure Properties::
* Axes Properties::
* Line Properties::
* Text Properties::
* Image Properties::
* Patch Properties::
* Surface Properties::
@end menu
In this Section the object properties are discussed in detail, starting
with the root figure properties and continuing through the graphics object
hierarchy.
@node Root Figure Properties
@subsubsection Root Figure Properties
@cindex root figure properties
The @code{root figure} properties are:
@table @code
@item __modified__
--- Values: @qcode{"on"}, @qcode{"off"}
@item __myhandle__
@item beingdeleted
--- Values: @qcode{"on"}, @qcode{"off"}
@item busyaction
@item buttondownfcn
@item callbackobject
@item children
@item clipping
--- Values: @qcode{"on"}, @qcode{"off"}
@item createfcn
@item currentfigure
@item deletefcn
@item handlevisibility
--- Values: @qcode{"on"}, @qcode{"off"}
@item hittest
--- Values: @qcode{"on"}, @qcode{"off"}
@item interruptible
--- Values: @qcode{"on"}, @qcode{"off"}
@item parent
@item screendepth
@item screenpixelsperinch
@item screensize
@item selected
@item selectionhighlight
@item screendepth
@item screenpixelsperinch
@item showhiddenhandles
--- Values: @qcode{"on"}, @qcode{"off"}
@item tag
@item type
@item uicontextmenu
@item units
@item userdata
@item visible
@end table
@node Figure Properties
@subsubsection Figure Properties
@cindex figure properties
The @code{figure} properties are:
@table @code
@item __graphics_toolkit__
--- The graphics toolkit currently in use.
@item __enhanced__
@item __modified__
@item __myhandle__
@item __plot_stream__
@item alphamap
@item beingdeleted
--- Values: @qcode{"on"}, @qcode{"off"}
@item busyaction
@item buttondownfcn
@item children
Handle to children.
@item clipping
--- Values: @qcode{"on"}, @qcode{"off"}
@item closerequestfcn
--- Handle of function to call on close.
@item color
@item colormap
An N-by-3 matrix containing the color map for the current axes.
@item paperorientation
@item createfcn
@item currentaxes
Handle to graphics object of current axes.
@item currentcharacter
@item currentobject
@item currentpoint
Holds the coordinates of the point over which the mouse pointer was when
the mouse button was pressed. If a mouse callback function is defined,
@qcode{"currentpoint"} holds the coordinates of the point over which the
mouse pointer is when the function gets called.
@item deletefcn
@item dockcontrols
--- Values: @qcode{"on"}, @qcode{"off"}
@item doublebuffer
--- Values: @qcode{"on"}, @qcode{"off"}
@item filename
@item handlevisibility
--- Values: @qcode{"on"}, @qcode{"off"}
@item hittest
@item integerhandle
@item interruptible
--- Values: @qcode{"on"}, @qcode{"off"}
@item inverthardcopy
@item keypressfcn
see @qcode{"keypressfcn"}
@item keyreleasefcn
With @qcode{"keypressfcn"}, the keyboard callback functions. These
callback functions get called when a key is pressed/released
respectively. The functions are called with two input arguments. The
first argument holds the handle of the calling figure. The second
argument holds the event structure which has the following members:
@table @code
@item Character
The ASCII value of the key
@item Key
lowercase value of the key
@item Modifier
A cell array containing strings representing the modifiers pressed with
the key. Possible values are @qcode{"shift"}, @qcode{"alt"}, and
@qcode{"control"}.
@end table
@item menubar
@item mincolormap
@item name
@item nextplot
May be one of
@table @asis
@item @qcode{"new"}
@item @qcode{"add"}
@item @qcode{"replace"}
@item @qcode{"replacechildren"}
@end table
@item numbertitle
@item paperorientation
Indicates the orientation for printing. Either @qcode{"landscape"} or
@qcode{"portrait"}.
@item paperposition
@item paperpositionmode
@item papersize
@item papertype
@item paperunits
@item pointer
@item pointershapecdata
@item pointershapehotspot
@item position
@item renderer
@item renderermode
@item resize
@item resizefcn
@item selected
@item selectionhighlight
--- Values: @qcode{"on"}, @qcode{"off"}
@item selectiontype
@item tag
@item toolbar
@item type
@item units
@item userdata
@item visible
Either @qcode{"on"} or @qcode{"off"} to toggle display of the figure.
@item windowbuttondownfcn
See @qcode{"windowbuttonupfcn"}
@item windowbuttonmotionfcn
See @qcode{"windowbuttonupfcn"}
@item windowbuttonupfcn
With @qcode{"windowbuttondownfcn"} and @qcode{"windowbuttonmotionfcn"},
the mouse callback functions. These callback functions get called when
the mouse button is pressed, dragged, and released respectively. When
these callback functions are called, the @qcode{"currentpoint"} property
holds the current coordinates of the cursor.
@item windowscrollwheelfcn
@item windowstyle
@item wvisual
@item wvisualmode
@item xdisplay
@item xvisual
@item xvisualmode
@end table
@node Axes Properties
@subsubsection Axes Properties
@cindex axes properties
The @code{axes} properties are:
@table @code
@item __modified__
@item __myhandle__
@item activepositionproperty
@item alim
@item alimmode
@item ambientlightcolor
@item beingdeleted
@item box
Box surrounding axes.
--- Values: @qcode{"on"}, @qcode{"off"}
@item busyaction
@item buttondownfcn
@item cameraposition
@item camerapositionmode
@item cameratarget
@item cameratargetmode
@item cameraupvector
@item cameraupvectormode
@item cameraviewangle
@item cameraviewanglemode
@item children
@item clim
Two-element vector defining the limits for the c axis of
an image. See @code{pcolor} property.
Setting this property also forces the corresponding mode
property to be set to @qcode{"manual"}.
@item climmode
Either @qcode{"manual"} or @qcode{"auto"}.
@item clipping
@item color
@item colororder
@item createfcn
@item currentpoint
Holds the coordinates of the point over which the mouse pointer was when
the mouse button was pressed. If a mouse callback function is defined,
@qcode{"currentpoint"} holds the coordinates of the point over which the
mouse pointer is when the function gets called.
@item dataaspectratio
A two-element vector specifying the relative height and width of the
data displayed in the axes. Setting @code{dataaspectratio} to @samp{1,
2]} causes the length of one unit as displayed on the y-axis to be the
same as the length of 2 units on the x-axis. Setting
@code{dataaspectratio} also forces the @code{dataaspectratiomode}
property to be set to @qcode{"manual"}.
@item dataaspectratiomode
Either @qcode{"manual"} or @qcode{"auto"}.
@item deletefcn
@item drawmode
@item fontangle
@item fontname
@item fontsize
@item fontunits
@item fontweight
@item gridlinestyle
@item handlevisibility
@item hittest
@item interpreter
@item interruptible
@item layer
@item linestyleorder
@item linewidth
@item minorgridlinestyle
@item nextplot
May be one of
@table @asis
@item @qcode{"add"}
@item @qcode{"replace"}
@item @qcode{"replacechildren"}
@end table
@item outerposition
A vector specifying the position of the plot, including titles, axes and
legend. The four elements of the vector are the coordinates of the
lower left corner and width and height of the plot, in units normalized
to the width and height of the plot window. For example, @code{[0.2,
0.3, 0.4, 0.5]} sets the lower left corner of the axes at @math{(0.2,
0.3)} and the width and height to be 0.4 and 0.5 respectively. See also
the @code{position} property.
@item parent
@item plotboxaspectratio
@item plotboxaspectratiomode
@item position
A vector specifying the position of the plot, excluding titles, axes and
legend. The four elements of the vector are the coordinates of the
lower left corner and width and height of the plot, in units normalized
to the width and height of the plot window. For example, @code{[0.2,
0.3, 0.4, 0.5]} sets the lower left corner of the axes at @math{(0.2,
0.3)} and the width and height to be 0.4 and 0.5 respectively. See also
the @code{outerposition} property.
@item projection
@item selected
@item selectionhighlight
@item tag
@item tickdir
@item tickdirmode
@item ticklength
@item tightinset
@item title
Index of text object for the axes title.
@item type
@item uicontextmenu
@item units
@item userdata
@item view
A three element vector specifying the view point for three-dimensional plots.
@item visible
Either @qcode{"on"} or @qcode{"off"} to toggle display of the axes.
@item x_normrendertransform
@item x_projectiontransform
@item x_rendertransform
@item x_viewporttransform
@item x_viewtransform
@item xaxislocation
Either @qcode{"top"} or @qcode{"bottom"}.
@item xcolor
@item xdir
Either @qcode{"forward"} or @qcode{"reverse"}.
@item xgrid
Either @qcode{"on"} or @qcode{"off"} to toggle display of grid lines.
@item xlabel
Indices to text objects for the axes labels.
@item xlim
Two-element vector defining the limits for the x-axis.
Setting this property also forces the corresponding mode
property to be set to @qcode{"manual"}.
@item xlimmode
Either @qcode{"manual"} or @qcode{"auto"}.
@item xminorgrid
Either @qcode{"on"} or @qcode{"off"} to toggle display of minor grid lines.
@item xminortick
@item xscale
Either @qcode{"linear"} or @qcode{"log"}.
@item xtick
Set position of tick marks.
Setting this property also forces the corresponding mode
property to be set to @qcode{"manual"}.
@item xticklabel
Setting this property also forces the corresponding mode
property to be set to @qcode{"manual"}.
@item xticklabelmode
Either @qcode{"manual"} or @qcode{"auto"}.
@item xtickmode
Either @qcode{"manual"} or @qcode{"auto"}.
@item yaxislocation
Either @qcode{"left"} or @qcode{"right"}
@item ycolor
@item ydir
Either @qcode{"forward"} or @qcode{"reverse"}.
@item ygrid
Either @qcode{"on"} or @qcode{"off"} to toggle display of grid lines.
@item ylabel
Indices to text objects for the axes labels.
@item ylim
Two-element vectors defining the limits for the x, y, and z axes and the
Setting one of these properties also forces the corresponding mode
property to be set to @qcode{"manual"}.
@item ylimmode
Either @qcode{"manual"} or @qcode{"auto"}.
@item yminorgrid
Either @qcode{"on"} or @qcode{"off"} to toggle display of minor grid lines.
@item yminortick
@item yscale
Either @qcode{"linear"} or @qcode{"log"}.
@item ytick
Set position of tick marks.
Setting this property also forces the corresponding mode
property to be set to @qcode{"manual"}.
@item yticklabel
Setting this property also forces the corresponding mode
property to be set to @qcode{"manual"}.
@item yticklabelmode
Either @qcode{"manual"} or @qcode{"auto"}.
@item ytickmode
Either @qcode{"manual"} or @qcode{"auto"}.
@item zcolor
@item zdir
Either @qcode{"forward"} or @qcode{"reverse"}.
@item zgrid
Either @qcode{"on"} or @qcode{"off"} to toggle display of grid lines.
@item zlabel
Indices to text objects for the axes labels.
@item zlim
Two-element vector defining the limits for z-axis.
Setting this property also forces the corresponding mode
property to be set to @qcode{"manual"}.
@item zlimmode
Either @qcode{"manual"} or @qcode{"auto"}.
@item zminorgrid
Either @qcode{"on"} or @qcode{"off"} to toggle display of minor grid lines.
@item zminortick
@item zscale
Either @qcode{"linear"} or @qcode{"log"}.
@item ztick
Set position of tick marks.
Setting this property also forces the corresponding mode
property to be set to @qcode{"manual"}.
@item zticklabel
Setting this property also forces the corresponding mode
property to be set to @qcode{"manual"}.
@item zticklabelmode
Either @qcode{"manual"} or @qcode{"auto"}.
@item ztickmode
Either @qcode{"manual"} or @qcode{"auto"}.
@end table
@node Line Properties
@subsubsection Line Properties
@cindex line properties
The @code{line} properties are:
@table @code
@item __modified__
@item __myhandle__
@item beingdeleted
@item busyaction
@item buttondownfcn
@item children
@item clipping
@item color
The RGB color of the line, or a color name. @xref{Colors}.
@item createfcn
@item deletefcn
@item displayname
The text of the legend entry corresponding to this line.
@item erasemode
@item handlevisibility
@item hittest
@item interpreter
@item interruptible
@item ldata
The lower errorbar in the y direction to be plotted.
@item linestyle
@itemx linewidth
@xref{Line Styles}.
@item linewidth
@item marker
@item markeredgecolor
@item markerfacecolor
@item markersize
@xref{Marker Styles}.
@item parent
@item selected
@item selectionhighlight
@item tag
@item type
@item udata
The upper errorbar in the y direction to be plotted.
@item uicontextmenu
@item userdata
@item visible
@item xdata
The data to be plotted.
@item xdatasource
@item xldata
The lower errorbar to be plotted.
@item xlim
@item xliminclude
@item xudata
The upper errorbar to be plotted.
@item ydata
The data to be plotted.
@item ydatasource
@item ylim
@item yliminclude
@item zdata
The data to be plotted.
@item zdatasource
@item zlim
@item zliminclude
@end table
@node Text Properties
@subsubsection Text Properties
@cindex text properties
The @code{text} properties are:
@table @code
@item __modified__
@item __myhandle__
@item backgroundcolor
@item beingdeleted
@item busyaction
@item buttondownfcn
@item children
@item clipping
@item color
The color of the text. @xref{Colors}.
@item createfcn
@item deletefcn
@item displayname
The text of the legend entry corresponding to this line.
@item edgecolor
@item editing
@item erasemode
@item fontangle
Flag whether the font is italic or normal. Valid values are @qcode{"normal"},
@qcode{"italic"}, and @qcode{"oblique"}.
@item fontname
The font used for the text.
@item fontsize
The size of the font, in points to use.
@item fontunits
@item fontweight
Flag whether the font is bold, etc. Valid values are @qcode{"normal"},
@qcode{"bold"}, @qcode{"demi"}, or @qcode{"light"}.
@item handlevisibility
@item hittest
@item horizontalalignment
May be @qcode{"left"}, @qcode{"center"}, or @qcode{"right"}.
@item interpreter
Determines how the text is rendered. Valid values are @qcode{"none"},
@qcode{"tex"}, or @qcode{"latex"}.
@item interruptible
@item linestyle
@item linewidth
@item margin
@item parent
@item position
The coordinates of the text object.
@item rotation
The angle of rotation for the displayed text, measured in degrees.
@item selected
@item selectionhighlight
@item string
The character string contained by the text object.
@item tag
@item type
@item uicontextmenu
@item units
May be @qcode{"normalized"} or @qcode{"graph"}.
@item userdata
@item verticalalignment
@item visible
@item xlim
@item xliminclude
@item ylim
@item yliminclude
@item zlim
@item zliminclude
@end table
@node Image Properties
@subsubsection Image Properties
@cindex image properties
The @code{image} properties are:
@table @code
@item __modified__
@item __myhandle__
@item beingdeleted
@item busyaction
@item buttondownfcn
@item cdata
The data for the image. Each pixel of the image corresponds to an
element of @code{cdata}. The value of an element of @code{cdata}
specifies the row-index into the colormap of the axes object containing
the image. The color value found in the color map for the given index
determines the color of the pixel.
@item cdatamapping
@item children
@item clim
@item climinclude
@item clipping
@item createfcn
@item deletefcn
@item handlevisibility
@item hittest
@item interruptible
@item parent
@item selected
@item selectionhighlight
@item tag
@item type
@item uicontextmenu
@item userdata
@item visible
@item xdata
Two-element vector specifying the range of the x-coordinates for
the image.
@item xlim
@item xliminclude
@item ydata
Two-element vector specifying the range of the y-coordinates for
the image.
@item ylim
@item yliminclude
@end table
@node Patch Properties
@subsubsection Patch Properties
@cindex patch properties
The @code{patch} properties are:
@table @code
@item __modified__
@item __myhandle__
@item alim
@item aliminclude
@item alphadatamapping
@item ambientstrength
@item backfacelighting
@item beingdeleted
@item busyaction
@item buttondownfcn
@item cdata
Data defining the patch object.
@item cdatamapping
@item children
@item clim
@item climinclude
@item clipping
@item createfcn
@item deletefcn
@item diffusestrength
@item displayname
The text of the legend entry corresponding to this line.
@item edgealpha
@item edgecolor
The color of the line defining the patch. @xref{Colors}.
@item edgelighting
@item erasemode
@item facealpha
A number in the range [0, 1] indicating the transparency of the patch.
@item facecolor
The fill color of the patch. @xref{Colors}.
@item facelighting
@item faces
@item facevertexalphadata
@item facevertexcdata
@item handlevisibility
@item hittest
@item interpreter
@item interruptible
@item linestyle
@xref{Line Styles}.
@item linewidth
@xref{Line Styles}.
@item marker
@xref{Marker Styles}.
@item markeredgecolor
@xref{Marker Styles}.
@item markerfacecolor
@xref{Marker Styles}.
@item markersize
@xref{Marker Styles}.
@item normalmode
@item parent
@item selected
@item selectionhighlight
@item specularcolorreflectance
@item specularexponent
@item specularstrength
@item tag
@item type
@item uicontextmenu
@item userdata
@item vertexnormals
@item vertices
@item visible
@item xdata
Data defining the patch object.
@item xlim
@item xliminclude
@item ydata
Data defining the patch object.
@item ylim
@item yliminclude
@item zdata
Data defining the patch object.
@item zlim
@item zliminclude
@end table
@node Surface Properties
@subsubsection Surface Properties
@cindex surface properties
The @code{surface} properties are:
@table @code
@item __modified__
@item __myhandle__
@item alim
@item aliminclude
@item alphadata
@item alphadatamapping
@item ambientstrength
@item backfacelighting
@item beingdeleted
@item busyaction
@item buttondownfcn
@item cdata
@item cdatamapping
@item cdatasource
@item children
@item clim
@item climinclude
@item clipping
@item createfcn
@item deletefcn
@item diffusestrength
@item displayname
The text of the legend entry corresponding to this surface.
@item edgealpha
@item edgecolor
@item edgelighting
@item erasemode
@item facealpha
@item facecolor
@item facelighting
@item handlevisibility
@item hittest
@item interpreter
@item interruptible
@item linestyle
@item linewidth
@item marker
@item markeredgecolor
@item markerfacecolor
@item markersize
@item meshstyle
@item normalmode
@item parent
@item selected
@item selectionhighlight
@item specularcolorreflectance
@item specularexponent
@item specularstrength
@item tag
@item type
@item uicontextmenu
@item userdata
@item vertexnormals
@item visible
@item xdata
The data determining the surface. The @code{xdata} and @code{ydata}
elements are vectors and @code{zdata} must be a matrix.
@item xdatasource
@item xlim
@item xliminclude
@item ydata
The data determining the surface. The @code{xdata} and @code{ydata}
elements are vectors and @code{zdata} must be a matrix.
@item ydatasource
@item ylim
@item yliminclude
@item zdata
The data determining the surface. The @code{xdata} and @code{ydata}
elements are vectors and @code{zdata} must be a matrix.
@item zdatasource
@item zlim
@item zliminclude
@end table
@node Searching Properties
@subsection Searching Properties
@c findobj scripts/plot/util/findobj.m
@anchor{XREFfindobj}
@deftypefn {Function File} {@var{h} =} findobj ()
@deftypefnx {Function File} {@var{h} =} findobj (@var{prop_name}, @var{prop_value}, @dots{})
@deftypefnx {Function File} {@var{h} =} findobj (@var{prop_name}, @var{prop_value}, "-@var{logical_op}", @var{prop_name}, @var{prop_value})
@deftypefnx {Function File} {@var{h} =} findobj ("-property", @var{prop_name})
@deftypefnx {Function File} {@var{h} =} findobj ("-regexp", @var{prop_name}, @var{pattern})
@deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, @dots{})
@deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, "flat", @dots{})
@deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, "-depth", @var{d}, @dots{})
Find graphics object with specified property values.
The simplest form is
@example
findobj (@var{prop_name}, @var{prop_value})
@end example
@noindent
which returns the handles of all objects which have a property named
@var{prop_name} that has the value @var{prop_value}. If multiple
property/value pairs are specified then only objects meeting all of the
conditions are returned.
The search can be limited to a particular set of objects and their
descendants, by passing a handle or set of handles @var{hlist} as the first
argument.
The depth of the object hierarchy to search can be limited with the
@qcode{"-depth"} argument. An example of searching only three generations
of children is:
@example
findobj (@var{hlist}, "-depth", 3, @var{prop_name}, @var{prop_value})
@end example
Specifying a depth @var{d} of 0, limits the search to the set of objects
passed in @var{hlist}. A depth @var{d} of 0 is equivalent to the
@qcode{"flat"} argument.
A specified logical operator may be applied to the pairs of @var{prop_name}
and @var{prop_value}. The supported logical operators are:
@qcode{"-and"}, @qcode{"-or"},
@qcode{"-xor"}, @qcode{"-not"}.
Objects may also be matched by comparing a regular expression to the
property values, where property values that match
@code{regexp (@var{prop_value}, @var{pattern})} are returned.
Finally, objects may be matched by property name only by using the
@qcode{"-property"} option.
Implementation Note: The search only includes objects with visible
handles (HandleVisibility = @qcode{"on"}). @xref{XREFfindall,,findall}, to
search for all objects including hidden ones.
@seealso{@ref{XREFfindall,,findall}, @ref{XREFallchild,,allchild}, @ref{XREFget,,get}, @ref{XREFset,,set}}
@end deftypefn
@c findall scripts/plot/util/findall.m
@anchor{XREFfindall}
@deftypefn {Function File} {@var{h} =} findall ()
@deftypefnx {Function File} {@var{h} =} findall (@var{prop_name}, @var{prop_value}, @dots{})
@deftypefnx {Function File} {@var{h} =} findall (@var{prop_name}, @var{prop_value}, "-@var{logical_op}", @var{prop_name}, @var{prop_value})
@deftypefnx {Function File} {@var{h} =} findall ("-property", @var{prop_name})
@deftypefnx {Function File} {@var{h} =} findall ("-regexp", @var{prop_name}, @var{pattern})
@deftypefnx {Function File} {@var{h} =} findall (@var{hlist}, @dots{})
@deftypefnx {Function File} {@var{h} =} findall (@var{hlist}, "flat", @dots{})
@deftypefnx {Function File} {@var{h} =} findall (@var{hlist}, "-depth", @var{d}, @dots{})
Find graphics object, including hidden ones, with specified property values.
The return value @var{h} is a list of handles to the found graphic objects.
@code{findall} performs the same search as @code{findobj}, but it
includes hidden objects (HandleVisibility = @qcode{"off"}). For full
documentation, @pxref{XREFfindobj,,findobj}.
@seealso{@ref{XREFfindobj,,findobj}, @ref{XREFallchild,,allchild}, @ref{XREFget,,get}, @ref{XREFset,,set}}
@end deftypefn
@node Managing Default Properties
@subsection Managing Default Properties
@cindex default graphics properties
@cindex graphics properties, default
Object properties have two classes of default values, @dfn{factory
defaults} (the initial values) and @dfn{user-defined defaults}, which
may override the factory defaults.
Although default values may be set for any object, they are set in
parent objects and apply to child objects, of the specified object type.
For example, setting the default @code{color} property of @code{line}
objects to @qcode{"green"}, for the @code{root} object, will result in all
@code{line} objects inheriting the @code{color} @qcode{"green"} as the default
value.
@example
set (0, "defaultlinecolor", "green");
@end example
@noindent
sets the default line color for all objects. The rule for constructing
the property name to set a default value is
@example
default + @var{object-type} + @var{property-name}
@end example
This rule can lead to some strange looking names, for example
@code{defaultlinelinewidth"} specifies the default @code{linewidth}
property for @code{line} objects.
The example above used the root figure object, 0, so the default
property value will apply to all line objects. However, default values
are hierarchical, so defaults set in a figure objects override those
set in the root figure object. Likewise, defaults set in axes objects
override those set in figure or root figure objects. For example,
@example
@group
subplot (2, 1, 1);
set (0, "defaultlinecolor", "red");
set (1, "defaultlinecolor", "green");
set (gca (), "defaultlinecolor", "blue");
line (1:10, rand (1, 10));
subplot (2, 1, 2);
line (1:10, rand (1, 10));
figure (2)
line (1:10, rand (1, 10));
@end group
@end example
@noindent
produces two figures. The line in first subplot window of the first
figure is blue because it inherits its color from its parent axes
object. The line in the second subplot window of the first figure is
green because it inherits its color from its parent figure object. The
line in the second figure window is red because it inherits its color
from the global root figure parent object.
To remove a user-defined default setting, set the default property to
the value @qcode{"remove"}. For example,
@example
set (gca (), "defaultlinecolor", "remove");
@end example
@noindent
removes the user-defined default line color setting from the current axes
object. To quickly remove all user-defined defaults use the @code{reset}
function.
@c reset libinterp/corefcn/graphics.cc
@anchor{XREFreset}
@deftypefn {Built-in Function} {} reset (@var{h}, @var{property})
Remove any defaults set for the handle @var{h}. The default figure
properties of @qcode{"position"}, @qcode{"units"},
@qcode{"windowstyle"} and @qcode{"paperunits"} and the default axes
properties of @qcode{"position"} and @qcode{"units"} are not reset.
@seealso{@ref{XREFcla,,cla}, @ref{XREFclf,,clf}}
@end deftypefn
Getting the @qcode{"default"} property of an object returns a list of
user-defined defaults set for the object. For example,
@example
get (gca (), "default");
@end example
@noindent
returns a list of user-defined default values for the current axes
object.
Factory default values are stored in the root figure object. The
command
@example
get (0, "factory");
@end example
@noindent
returns a list of factory defaults.
@node Advanced Plotting
@section Advanced Plotting
@menu
* Colors::
* Line Styles::
* Marker Styles::
* Callbacks::
* Application-defined Data::
* Object Groups::
* Graphics Toolkits::
@end menu
@node Colors
@subsection Colors
@cindex graphics colors
@cindex colors, graphics
Colors may be specified as RGB triplets with values ranging from zero to
one, or by name. Recognized color names include @qcode{"blue"},
@qcode{"black"}, @qcode{"cyan"}, @qcode{"green"}, @qcode{"magenta"},
@qcode{"red"}, @qcode{"white"}, and @qcode{"yellow"}.
@node Line Styles
@subsection Line Styles
@cindex line styles, graphics
@cindex graphics line styles
Line styles are specified by the following properties:
@table @code
@item linestyle
May be one of
@table @code
@item "-"
Solid line. [default]
@item "--"
Dashed line.
@item ":"
Dotted line.
@item "-."
A dash-dot line.
@item @qcode{"none"}
No line. Points will still be marked using the current Marker Style.
@end table
@item linewidth
A number specifying the width of the line. The default is 1. A value
of 2 is twice as wide as the default, etc.
@end table
@node Marker Styles
@subsection Marker Styles
@cindex graphics marker styles
@cindex marker styles, graphics
Marker styles are specified by the following properties:
@table @code
@item marker
A character indicating a plot marker to be place at each data point, or
@qcode{"none"}, meaning no markers should be displayed.
@item markeredgecolor
The color of the edge around the marker, or @qcode{"auto"}, meaning that
the edge color is the same as the face color. @xref{Colors}.
@item markerfacecolor
The color of the marker, or @qcode{"none"} to indicate that the marker
should not be filled. @xref{Colors}.
@item markersize
A number specifying the size of the marker. The default is 1. A value
of 2 is twice as large as the default, etc.
@end table
The @code{colstyle} function will parse a @code{plot}-style specification
and will return the color, line, and marker values that would result.
@c colstyle scripts/plot/util/colstyle.m
@anchor{XREFcolstyle}
@deftypefn {Function File} {[@var{style}, @var{color}, @var{marker}, @var{msg}] =} colstyle (@var{linespec})
Parse @var{linespec} and return the line style, color, and markers given.
In the case of an error, the string @var{msg} will return the text of the
error.
@end deftypefn
@node Callbacks
@subsection Callbacks
@cindex callbacks
Callback functions can be associated with graphics objects and triggered
after certain events occur. The basic structure of all callback function
is
@example
@group
function mycallback (src, data)
@dots{}
endfunction
@end group
@end example
@noindent
where @code{src} gives a handle to the source of the callback, and
@code{code} gives some event specific data. This can then be associated
with an object either at the objects creation or later with the
@code{set} function. For example,
@example
plot (x, "DeleteFcn", @@(s, e) disp ("Window Deleted"))
@end example
@noindent
where at the moment that the plot is deleted, the message "Window
Deleted" will be displayed.
Additional user arguments can be passed to callback functions, and will
be passed after the 2 default arguments. For example:
@example
@group
plot (x, "DeleteFcn", @{@@mycallback, "1"@})
@dots{}
function mycallback (src, data, a1)
fprintf ("Closing plot %d\n", a1);
endfunction
@end group
@end example
The basic callback functions that are available for all graphics objects
are
@itemize @bullet
@item CreateFcn
This is the callback that is called at the moment of the objects
creation. It is not called if the object is altered in any way, and so
it only makes sense to define this callback in the function call that
defines the object. Callbacks that are added to @code{CreateFcn} later with
the @code{set} function will never be executed.
@item DeleteFcn
This is the callback that is called at the moment an object is deleted.
@item ButtonDownFcn
This is the callback that is called if a mouse button is pressed while
the pointer is over this object. Note, that the gnuplot interface does
not respect this callback.
@end itemize
The object and figure that the event occurred in that resulted in the
callback being called can be found with the @code{gcbo} and @code{gcbf}
functions.
@c gcbo scripts/plot/util/gcbo.m
@anchor{XREFgcbo}
@deftypefn {Function File} {@var{h} =} gcbo ()
@deftypefnx {Function File} {[@var{h}, @var{fig}] =} gcbo ()
Return a handle to the object whose callback is currently executing.
If no callback is executing, this function returns the empty matrix. This
handle is obtained from the root object property @qcode{"CallbackObject"}.
When called with a second output argument, return the handle of the figure
containing the object whose callback is currently executing. If no callback
is executing the second output is also set to the empty matrix.
@seealso{@ref{XREFgcbf,,gcbf}, @ref{XREFgco,,gco}, @ref{XREFgca,,gca}, @ref{XREFgcf,,gcf}, @ref{XREFget,,get}, @ref{XREFset,,set}}
@end deftypefn
@c gcbf scripts/plot/util/gcbf.m
@anchor{XREFgcbf}
@deftypefn {Function File} {@var{fig} =} gcbf ()
Return a handle to the figure containing the object whose callback is
currently executing.
If no callback is executing, this function returns the empty matrix. The
handle returned by this function is the same as the second output argument
of @code{gcbo}.
@seealso{@ref{XREFgcbo,,gcbo}, @ref{XREFgcf,,gcf}, @ref{XREFgco,,gco}, @ref{XREFgca,,gca}, @ref{XREFget,,get}, @ref{XREFset,,set}}
@end deftypefn
Callbacks can equally be added to properties with the @code{addlistener}
function described below.
@node Application-defined Data
@subsection Application-defined Data
@cindex application-defined data
Octave has a provision for attaching application-defined data to a graphics
handle. The data can be anything which is meaningful to the application, and
will be completely ignored by Octave.
@c setappdata scripts/miscellaneous/setappdata.m
@anchor{XREFsetappdata}
@deftypefn {Function File} {} setappdata (@var{h}, @var{name}, @var{value})
Set the named application data to @var{value} for the object(s) with
handle(s) @var{h}. If the application data with the specified name does
not exist, it is created.
@seealso{@ref{XREFgetappdata,,getappdata}, @ref{XREFguidata,,guidata}, @ref{XREFget,,get}, @ref{XREFset,,set}, @ref{XREFgetpref,,getpref}, @ref{XREFsetpref,,setpref}}
@end deftypefn
@c getappdata scripts/miscellaneous/getappdata.m
@anchor{XREFgetappdata}
@deftypefn {Function File} {@var{value} =} getappdata (@var{h}, @var{name})
@deftypefnx {Function File} {@var{appdata} =} getappdata (@var{h})
Return the @var{value} for named application data for the object(s) with
handle(s) @var{h}.
@code{getappdata(@var{h})} returns a structure, @var{appdata}, whose fields
correspond to the appdata properties.
@seealso{@ref{XREFsetappdata,,setappdata}, @ref{XREFguidata,,guidata}, @ref{XREFget,,get}, @ref{XREFset,,set}, @ref{XREFgetpref,,getpref}, @ref{XREFsetpref,,setpref}}
@end deftypefn
@c rmappdata scripts/miscellaneous/rmappdata.m
@anchor{XREFrmappdata}
@deftypefn {Function File} {} rmappdata (@var{h}, @var{name})
Delete the named application data for the object(s) with
handle(s) @var{h}.
@end deftypefn
@c isappdata scripts/miscellaneous/isappdata.m
@anchor{XREFisappdata}
@deftypefn {Function File} {@var{V} =} isappdata (@var{h}, @var{name})
Return true if the named application data, @var{name}, exists for the
object with handle @var{h}.
@seealso{@ref{XREFgetappdata,,getappdata}, @ref{XREFsetappdata,,setappdata}, @ref{XREFrmappdata,,rmappdata}}
@end deftypefn
@node Object Groups
@subsection Object Groups
@cindex object groups
A number of Octave high level plot functions return groups of other
graphics objects or they return graphics objects that have their
properties linked in such a way that changes to one of the properties
results in changes in the others. A graphic object that groups other
objects is an @code{hggroup}
@c hggroup scripts/plot/util/hggroup.m
@anchor{XREFhggroup}
@deftypefn {Function File} {} hggroup ()
@deftypefnx {Function File} {} hggroup (@var{hax})
@deftypefnx {Function File} {} hggroup (@dots{}, @var{property}, @var{value}, @dots{})
@deftypefnx {Function File} {@var{h} =} hggroup (@dots{})
Create handle graphics group object with axes parent @var{hax}.
If no parent is specified, the group is created in the current axes.
Multiple property/value pairs may be specified for the hggroup, but they
must appear in pairs.
The optional return value @var{h} is a graphics handle to the created
hggroup object.
Programming Note: An hggroup is a way to group base graphics objects such
as line objects or patch objects into a single unit which can react
appropriately. For example, the individual lines of a contour plot are
collected into a single hggroup so that they can be made visible/invisible
with a single command, @code{set (hg_handle, "visible", "off")}.
@seealso{@ref{XREFaddproperty,,addproperty}, @ref{XREFaddlistener,,addlistener}}
@end deftypefn
For example a simple use of a @code{hggroup} might be
@example
@group
x = 0:0.1:10;
hg = hggroup ();
plot (x, sin (x), "color", [1, 0, 0], "parent", hg);
hold on
plot (x, cos (x), "color", [0, 1, 0], "parent", hg);
set (hg, "visible", "off");
@end group
@end example
@noindent
which groups the two plots into a single object and controls their
visibility directly. The default properties of an @code{hggroup} are
the same as the set of common properties for the other graphics
objects. Additional properties can be added with the @code{addproperty}
function.
@c addproperty libinterp/corefcn/graphics.cc
@anchor{XREFaddproperty}
@deftypefn {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type})
@deftypefnx {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type}, @var{arg}, @dots{})
Create a new property named @var{name} in graphics object @var{h}.
@var{type} determines the type of the property to create. @var{args}
usually contains the default value of the property, but additional
arguments might be given, depending on the type of the property.
The supported property types are:
@table @code
@item string
A string property. @var{arg} contains the default string value.
@item any
An @nospell{un-typed} property. This kind of property can hold any octave
value. @var{args} contains the default value.
@item radio
A string property with a limited set of accepted values. The first
argument must be a string with all accepted values separated by
a vertical bar ('|'). The default value can be marked by enclosing
it with a '@{' '@}' pair. The default value may also be given as
an optional second string argument.
@item boolean
A boolean property. This property type is equivalent to a radio
property with "on|off" as accepted values. @var{arg} contains
the default property value.
@item double
A scalar double property. @var{arg} contains the default value.
@item handle
A handle property. This kind of property holds the handle of a
graphics object. @var{arg} contains the default handle value.
When no default value is given, the property is initialized to
the empty matrix.
@item data
A data (matrix) property. @var{arg} contains the default data
value. When no default value is given, the data is initialized to
the empty matrix.
@item color
A color property. @var{arg} contains the default color value.
When no default color is given, the property is set to black.
An optional second string argument may be given to specify an
additional set of accepted string values (like a radio property).
@end table
@var{type} may also be the concatenation of a core object type and
a valid property name for that object type. The property created
then has the same characteristics as the referenced property (type,
possible values, hidden state@dots{}). This allows to clone an existing
property into the graphics object @var{h}.
Examples:
@example
@group
addproperty ("my_property", gcf, "string", "a string value");
addproperty ("my_radio", gcf, "radio", "val_1|val_2|@{val_3@}");
addproperty ("my_style", gcf, "linelinestyle", "--");
@end group
@end example
@seealso{@ref{XREFaddlistener,,addlistener}, @ref{XREFhggroup,,hggroup}}
@end deftypefn
Once a property in added to an @code{hggroup}, it is not linked to any
other property of either the children of the group, or any other
graphics object. Add so to control the way in which this newly added
property is used, the @code{addlistener} function is used to define a
callback function that is executed when the property is altered.
@c addlistener libinterp/corefcn/graphics.cc
@anchor{XREFaddlistener}
@deftypefn {Built-in Function} {} addlistener (@var{h}, @var{prop}, @var{fcn})
Register @var{fcn} as listener for the property @var{prop} of the graphics
object @var{h}. Property listeners are executed (in order of registration)
when the property is set. The new value is already available when the
listeners are executed.
@var{prop} must be a string naming a valid property in @var{h}.
@var{fcn} can be a function handle, a string or a cell array whose first
element is a function handle. If @var{fcn} is a function handle, the
corresponding function should accept at least 2 arguments, that will be
set to the object handle and the empty matrix respectively. If @var{fcn}
is a string, it must be any valid octave expression. If @var{fcn} is a cell
array, the first element must be a function handle with the same signature
as described above. The next elements of the cell array are passed
as additional arguments to the function.
Example:
@example
@group
function my_listener (h, dummy, p1)
fprintf ("my_listener called with p1=%s\n", p1);
endfunction
addlistener (gcf, "position", @{@@my_listener, "my string"@})
@end group
@end example
@seealso{@ref{XREFaddproperty,,addproperty}, @ref{XREFhggroup,,hggroup}}
@end deftypefn
@c dellistener libinterp/corefcn/graphics.cc
@anchor{XREFdellistener}
@deftypefn {Built-in Function} {} dellistener (@var{h}, @var{prop}, @var{fcn})
Remove the registration of @var{fcn} as a listener for the property
@var{prop} of the graphics object @var{h}. The function @var{fcn} must
be the same variable (not just the same value), as was passed to the
original call to @code{addlistener}.
If @var{fcn} is not defined then all listener functions of @var{prop}
are removed.
Example:
@example
@group
function my_listener (h, dummy, p1)
fprintf ("my_listener called with p1=%s\n", p1);
endfunction
c = @{@@my_listener, "my string"@};
addlistener (gcf, "position", c);
dellistener (gcf, "position", c);
@end group
@end example
@end deftypefn
An example of the use of these two functions might be
@example
@group
x = 0:0.1:10;
hg = hggroup ();
h = plot (x, sin (x), "color", [1, 0, 0], "parent", hg);
addproperty ("linestyle", hg, "linelinestyle", get (h, "linestyle"));
addlistener (hg, "linestyle", @@update_props);
hold on
plot (x, cos (x), "color", [0, 1, 0], "parent", hg);
function update_props (h, d)
set (get (h, "children"), "linestyle", get (h, "linestyle"));
endfunction
@end group
@end example
@noindent
that adds a @code{linestyle} property to the @code{hggroup} and
propagating any changes its value to the children of the group. The
@code{linkprop} function can be used to simplify the above to be
@example
@group
x = 0:0.1:10;
hg = hggroup ();
h1 = plot (x, sin (x), "color", [1, 0, 0], "parent", hg);
addproperty ("linestyle", hg, "linelinestyle", get (h, "linestyle"));
hold on
h2 = plot (x, cos (x), "color", [0, 1, 0], "parent", hg);
hlink = linkprop ([hg, h1, h2], "color");
@end group
@end example
@c linkprop scripts/plot/util/linkprop.m
@anchor{XREFlinkprop}
@deftypefn {Function File} {@var{hlink} =} linkprop (@var{h}, @var{prop})
@deftypefnx {Function File} {@var{hlink} =} linkprop (@var{h}, @{@var{prop1}, @var{prop2}, @dots{}@})
Link graphics object properties, such that a change in one is
propagated to the others.
@var{prop} can be a string for a single property, or a cell array of strings
for multiple properties. @var{h} is an array of graphics handles which
will have their properties linked.
An example of the use of @code{linkprop} is
@example
@group
x = 0:0.1:10;
subplot (1,2,1);
h1 = plot (x, sin (x));
subplot (1,2,2);
h2 = plot (x, cos (x));
hlink = linkprop ([h1, h2], @{"color","linestyle"@});
set (h1, "color", "green");
set (h2, "linestyle", "--");
@end group
@end example
@end deftypefn
These capabilities are used in a number of basic graphics objects.
The @code{hggroup} objects created by the functions of Octave contain
one or more graphics object and are used to:
@itemize @bullet
@item group together multiple graphics objects,
@item create linked properties between different graphics objects, and
@item to hide the nominal user data, from the actual data of the objects.
@end itemize
@noindent
For example the @code{stem} function creates a stem series where each
@code{hggroup} of the stem series contains two line objects representing
the body and head of the stem. The @code{ydata} property of the
@code{hggroup} of the stem series represents the head of the stem,
whereas the body of the stem is between the baseline and this value. For
example
@example
@group
h = stem (1:4)
get (h, "xdata")
@result{} [ 1 2 3 4]'
get (get (h, "children")(1), "xdata")
@result{} [ 1 1 NaN 2 2 NaN 3 3 NaN 4 4 NaN]'
@end group
@end example
@noindent
shows the difference between the @code{xdata} of the @code{hggroup}
of a stem series object and the underlying line.
The basic properties of such group objects is that they consist of one
or more linked @code{hggroup}, and that changes in certain properties of
these groups are propagated to other members of the group. Whereas,
certain properties of the members of the group only apply to the current
member.
In addition the members of the group can also be linked to other
graphics objects through callback functions. For example the baseline of
the @code{bar} or @code{stem} functions is a line object, whose length
and position are automatically adjusted, based on changes to the
corresponding hggroup elements.
@menu
* Data Sources in Object Groups::
* Area Series::
* Bar Series::
* Contour Groups::
* Error Bar Series::
* Line Series::
* Quiver Group::
* Scatter Group::
* Stair Group::
* Stem Series::
* Surface Group::
@end menu
@node Data Sources in Object Groups
@subsubsection Data Sources in Object Groups
@cindex data sources in object groups
@anchor{XREFdatasources}
All of the group objects contain data source parameters. There are
string parameters that contain an expression that is evaluated to update
the relevant data property of the group when the @code{refreshdata}
function is called.
@c refreshdata scripts/plot/util/refreshdata.m
@anchor{XREFrefreshdata}
@deftypefn {Function File} {} refreshdata ()
@deftypefnx {Function File} {} refreshdata (@var{h})
@deftypefnx {Function File} {} refreshdata (@var{h}, @var{workspace})
Evaluate any @samp{datasource} properties of the current figure and update
the plot if the corresponding data has changed.
If the first argument @var{h} is a list of graphic handles, then operate
on these objects rather than the current figure returned by @code{gcf}.
The optional second argument @var{workspace} can take the following values:
@table @asis
@item @qcode{"base"}
Evaluate the datasource properties in the base workspace. (default).
@item @qcode{"caller"}
Evaluate the datasource properties in the workspace of the function
that called @code{refreshdata}.
@end table
An example of the use of @code{refreshdata} is:
@example
@group
x = 0:0.1:10;
y = sin (x);
plot (x, y, "ydatasource", "y");
for i = 1 : 100
pause (0.1);
y = sin (x + 0.1*i);
refreshdata ();
endfor
@end group
@end example
@end deftypefn
@anchor{XREFlinkdata}
@c add the description of the linkdata function here when it is written
@c remove the explicit anchor when you add the corresponding @DOCSTRING
@c command
@node Area Series
@subsubsection Area Series
@cindex series objects
@cindex area series
Area series objects are created by the @code{area} function. Each of the
@code{hggroup} elements contains a single patch object. The properties
of the area series are
@table @code
@item basevalue
The value where the base of the area plot is drawn.
@item linewidth
@itemx linestyle
The line width and style of the edge of the patch objects making up the
areas. @xref{Line Styles}.
@item edgecolor
@itemx facecolor
The line and fill color of the patch objects making up the areas.
@xref{Colors}.
@item xdata
@itemx ydata
The x and y coordinates of the original columns of the data passed to
@code{area} prior to the cumulative summation used in the @code{area}
function.
@item xdatasource
@itemx ydatasource
Data source variables.
@end table
@node Bar Series
@subsubsection Bar Series
@cindex series objects
@cindex bar series
Bar series objects are created by the @code{bar} or @code{barh}
functions. Each @code{hggroup} element contains a single patch object.
The properties of the bar series are
@table @code
@item showbaseline
@itemx baseline
@itemx basevalue
The property @code{showbaseline} flags whether the baseline of the bar
series is displayed (default is @qcode{"on"}). The handle of the graphics
object representing the baseline is given by the @code{baseline} property and
the y-value of the baseline by the @code{basevalue} property.
Changes to any of these properties are propagated to the other members of
the bar series and to the baseline itself. Equally, changes in the
properties of the base line itself are propagated to the members of the
corresponding bar series.
@item barwidth
@itemx barlayout
@itemx horizontal
The property @code{barwidth} is the width of the bar corresponding to
the @var{width} variable passed to @code{bar} or @var{barh}. Whether the
bar series is @qcode{"grouped"} or @qcode{"stacked"} is determined by the
@code{barlayout} property and whether the bars are horizontal or
vertical by the @code{horizontal} property.
Changes to any of these property are propagated to the other members of
the bar series.
@item linewidth
@itemx linestyle
The line width and style of the edge of the patch objects making up the
bars. @xref{Line Styles}.
@item edgecolor
@itemx facecolor
The line and fill color of the patch objects making up the bars. @xref{Colors}.
@item xdata
The nominal x positions of the bars. Changes in this property and
propagated to the other members of the bar series.
@item ydata
The y value of the bars in the @code{hggroup}.
@item xdatasource
@itemx ydatasource
Data source variables.
@end table
@node Contour Groups
@subsubsection Contour Groups
@cindex series objects
@cindex contour series
Contour group objects are created by the @code{contour}, @code{contourf}
and @code{contour3} functions. The are equally one of the handles returned
by the @code{surfc} and @code{meshc} functions. The properties of the contour
group are
@table @code
@item contourmatrix
A read only property that contains the data return by @code{contourc} used to
create the contours of the plot.
@item fill
A radio property that can have the values @qcode{"on"} or @qcode{"off"} that
flags whether the contours to plot are to be filled.
@item zlevelmode
@itemx zlevel
The radio property @code{zlevelmode} can have the values @qcode{"none"},
@qcode{"auto"}, or @qcode{"manual"}. When its value is @qcode{"none"} there is
no z component to the plotted contours. When its value is @qcode{"auto"} the z
value of the plotted contours is at the same value as the contour itself. If
the value is @qcode{"manual"}, then the z value at which to plot the contour is
determined by the @code{zlevel} property.
@item levellistmode
@itemx levellist
@itemx levelstepmode
@itemx levelstep
If @code{levellistmode} is @qcode{"manual"}, then the levels at which to plot
the contours is determined by @code{levellist}. If @code{levellistmode} is set
to @qcode{"auto"}, then the distance between contours is determined by
@code{levelstep}. If both @code{levellistmode} and @code{levelstepmode} are
set to @qcode{"auto"}, then there are assumed to be 10 equal spaced contours.
@item textlistmode
@itemx textlist
@itemx textstepmode
@itemx textstep
If @code{textlistmode} is @qcode{"manual"}, then the labeled contours
is determined by @code{textlist}. If @code{textlistmode} is set to
@qcode{"auto"}, then the distance between labeled contours is determined by
@code{textstep}. If both @code{textlistmode} and @code{textstepmode}
are set to @qcode{"auto"}, then there are assumed to be 10 equal spaced
labeled contours.
@item showtext
Flag whether the contour labels are shown or not.
@item labelspacing
The distance between labels on a single contour in points.
@item linewidth
@item linestyle
@item linecolor
The properties of the contour lines. The properties @code{linewidth} and
@code{linestyle} are similar to the corresponding properties for lines. The
property @code{linecolor} is a color property (@pxref{Colors}), that can also
have the values of @qcode{"none"} or @qcode{"auto"}. If @code{linecolor} is
@qcode{"none"}, then no contour line is drawn. If @code{linecolor} is
@qcode{"auto"} then the line color is determined by the colormap.
@item xdata
@itemx ydata
@itemx zdata
The original x, y, and z data of the contour lines.
@item xdatasource
@itemx ydatasource
@itemx zdatasource
Data source variables.
@end table
@node Error Bar Series
@subsubsection Error Bar Series
@cindex series objects
@cindex error bar series
Error bar series are created by the @code{errorbar} function. Each
@code{hggroup} element contains two line objects representing the data and
the errorbars separately. The properties of the error bar series are
@table @code
@item color
The RGB color or color name of the line objects of the error bars.
@xref{Colors}.
@item linewidth
@itemx linestyle
The line width and style of the line objects of the error bars. @xref{Line
Styles}.
@item marker
@itemx markeredgecolor
@itemx markerfacecolor
@itemx markersize
The line and fill color of the markers on the error bars. @xref{Colors}.
@item xdata
@itemx ydata
@itemx ldata
@itemx udata
@itemx xldata
@itemx xudata
The original x, y, l, u, xl, xu data of the error bars.
@item xdatasource
@itemx ydatasource
@itemx ldatasource
@itemx udatasource
@itemx xldatasource
@itemx xudatasource
Data source variables.
@end table
@node Line Series
@subsubsection Line Series
@cindex series objects
@cindex line series
Line series objects are created by the @code{plot} and @code{plot3}
functions and are of the type @code{line}. The properties of the
line series with the ability to add data sources.
@table @code
@item color
The RGB color or color name of the line objects. @xref{Colors}.
@item linewidth
@itemx linestyle
The line width and style of the line objects. @xref{Line Styles}.
@item marker
@itemx markeredgecolor
@itemx markerfacecolor
@itemx markersize
The line and fill color of the markers. @xref{Colors}.
@item xdata
@itemx ydata
@itemx zdata
The original x, y and z data.
@item xdatasource
@itemx ydatasource
@itemx zdatasource
Data source variables.
@end table
@node Quiver Group
@subsubsection Quiver Group
@cindex group objects
@cindex quiver group
Quiver series objects are created by the @code{quiver} or @code{quiver3}
functions. Each @code{hggroup} element of the series contains three line
objects as children representing the body and head of the arrow,
together with a marker as the point of origin of the arrows. The
properties of the quiver series are
@table @code
@item autoscale
@itemx autoscalefactor
Flag whether the length of the arrows is scaled or defined directly from
the @var{u}, @var{v} and @var{w} data. If the arrow length is flagged
as being scaled by the @code{autoscale} property, then the length of the
autoscaled arrow is controlled by the @code{autoscalefactor}.
@item maxheadsize
This property controls the size of the head of the arrows in the quiver
series. The default value is 0.2.
@item showarrowhead
Flag whether the arrow heads are displayed in the quiver plot.
@item color
The RGB color or color name of the line objects of the quiver. @xref{Colors}.
@item linewidth
@itemx linestyle
The line width and style of the line objects of the quiver. @xref{Line Styles}.
@item marker
@itemx markerfacecolor
@itemx markersize
The line and fill color of the marker objects at the original of the
arrows. @xref{Colors}.
@item xdata
@itemx ydata
@itemx zdata
The origins of the values of the vector field.
@item udata
@itemx vdata
@itemx wdata
The values of the vector field to plot.
@item xdatasource
@itemx ydatasource
@itemx zdatasource
@itemx udatasource
@itemx vdatasource
@itemx wdatasource
Data source variables.
@end table
@node Scatter Group
@subsubsection Scatter Group
@cindex group objects
@cindex scatter group
Scatter series objects are created by the @code{scatter} or @code{scatter3}
functions. A single hggroup element contains as many children as there are
points in the scatter plot, with each child representing one of the points.
The properties of the stem series are
@table @code
@item linewidth
The line width of the line objects of the points. @xref{Line Styles}.
@item marker
@itemx markeredgecolor
@itemx markerfacecolor
The line and fill color of the markers of the points. @xref{Colors}.
@item xdata
@itemx ydata
@itemx zdata
The original x, y and z data of the stems.
@item cdata
The color data for the points of the plot. Each point can have a separate
color, or a unique color can be specified.
@item sizedata
The size data for the points of the plot. Each point can its own size or a
unique size can be specified.
@item xdatasource
@itemx ydatasource
@itemx zdatasource
@itemx cdatasource
@itemx sizedatasource
Data source variables.
@end table
@node Stair Group
@subsubsection Stair Group
@cindex group objects
@cindex stair group
Stair series objects are created by the @code{stair} function. Each
@code{hggroup} element of the series contains a single line object as a
child representing the stair. The properties of the stair series are
@table @code
@item color
The RGB color or color name of the line objects of the stairs. @xref{Colors}.
@item linewidth
@itemx linestyle
The line width and style of the line objects of the stairs. @xref{Line Styles}.
@item marker
@itemx markeredgecolor
@itemx markerfacecolor
@itemx markersize
The line and fill color of the markers on the stairs. @xref{Colors}.
@item xdata
@itemx ydata
The original x and y data of the stairs.
@item xdatasource
@itemx ydatasource
Data source variables.
@end table
@node Stem Series
@subsubsection Stem Series
@cindex series objects
@cindex stem series
Stem series objects are created by the @code{stem} or @code{stem3}
functions. Each @code{hggroup} element contains a single line object
as a child representing the stems. The properties of the stem series
are
@table @code
@item showbaseline
@itemx baseline
@itemx basevalue
The property @code{showbaseline} flags whether the baseline of the
stem series is displayed (default is @qcode{"on"}). The handle of the graphics
object representing the baseline is given by the @code{baseline}
property and the y-value (or z-value for @code{stem3}) of the baseline
by the @code{basevalue} property.
Changes to any of these property are propagated to the other members of
the stem series and to the baseline itself. Equally changes in the
properties of the base line itself are propagated to the members of the
corresponding stem series.
@item color
The RGB color or color name of the line objects of the stems. @xref{Colors}.
@item linewidth
@itemx linestyle
The line width and style of the line objects of the stems. @xref{Line Styles}.
@item marker
@itemx markeredgecolor
@itemx markerfacecolor
@itemx markersize
The line and fill color of the markers on the stems. @xref{Colors}.
@item xdata
@itemx ydata
@itemx zdata
The original x, y and z data of the stems.
@item xdatasource
@itemx ydatasource
@itemx zdatasource
Data source variables.
@end table
@node Surface Group
@subsubsection Surface Group
@cindex group objects
@cindex surface group
Surface group objects are created by the @code{surf} or @code{mesh}
functions, but are equally one of the handles returned by the @code{surfc}
or @code{meshc} functions. The surface group is of the type @code{surface}.
The properties of the surface group are
@table @code
@item edgecolor
@item facecolor
The RGB color or color name of the edges or faces of the surface.
@xref{Colors}.
@item linewidth
@itemx linestyle
The line width and style of the lines on the surface. @xref{Line Styles}.
@item marker
@itemx markeredgecolor
@itemx markerfacecolor
@itemx markersize
The line and fill color of the markers on the surface. @xref{Colors}.
@item xdata
@itemx ydata
@itemx zdata
@itemx cdata
The original x, y, z and c data.
@item xdatasource
@itemx ydatasource
@itemx zdatasource
@itemx cdatasource
Data source variables.
@end table
@node Graphics Toolkits
@subsection Graphics Toolkits
@cindex graphics toolkits
@cindex toolkits, graphics
@c graphics_toolkit scripts/plot/util/graphics_toolkit.m
@anchor{XREFgraphics_toolkit}
@deftypefn {Function File} {@var{name} =} graphics_toolkit ()
@deftypefnx {Function File} {@var{name} =} graphics_toolkit (@var{hlist})
@deftypefnx {Function File} {} graphics_toolkit (@var{name})
@deftypefnx {Function File} {} graphics_toolkit (@var{hlist}, @var{name})
Query or set the default graphics toolkit which is assigned to new figures.
With no inputs, return the current default graphics toolkit. If the input
is a list of figure graphic handles, @var{hlist}, then return the name
of the graphics toolkit in use for each figure.
When called with a single input @var{name} set the default graphics toolkit
to @var{name}. If the toolkit is not already loaded, it is initialized by
calling the function @code{__init_@var{name}__}. If the first input
is a list of figure handles, @var{hlist}, then the graphics toolkit is set
to @var{name} for these figures only.
@seealso{@ref{XREFavailable_graphics_toolkits,,available_graphics_toolkits}}
@end deftypefn
@c available_graphics_toolkits libinterp/corefcn/graphics.cc
@anchor{XREFavailable_graphics_toolkits}
@deftypefn {Built-in Function} {} available_graphics_toolkits ()
Return a cell array of registered graphics toolkits.
@seealso{@ref{XREFgraphics_toolkit,,graphics_toolkit}, @ref{XREFregister_graphics_toolkit,,register_graphics_toolkit}}
@end deftypefn
@c loaded_graphics_toolkits libinterp/corefcn/graphics.cc
@anchor{XREFloaded_graphics_toolkits}
@deftypefn {Built-in Function} {} loaded_graphics_toolkits ()
Return a cell array of the currently loaded graphics toolkits.
@seealso{@ref{XREFavailable_graphics_toolkits,,available_graphics_toolkits}}
@end deftypefn
@c register_graphics_toolkit libinterp/corefcn/graphics.cc
@anchor{XREFregister_graphics_toolkit}
@deftypefn {Built-in Function} {} register_graphics_toolkit (@var{toolkit})
List @var{toolkit} as an available graphics toolkit.
@seealso{@ref{XREFavailable_graphics_toolkits,,available_graphics_toolkits}}
@end deftypefn
@menu
* Customizing Toolkit Behavior::
@end menu
@node Customizing Toolkit Behavior
@subsubsection Customizing Toolkit Behavior
@cindex toolkit customization
The specific behavior of the backend toolkit may be modified using the
following utility functions. Note: Not all functions apply to every
graphics toolkit.
@c gnuplot_binary scripts/plot/util/gnuplot_binary.m
@anchor{XREFgnuplot_binary}
@deftypefn {Loadable Function} {[@var{prog}, @var{args}] =} gnuplot_binary ()
@deftypefnx {Loadable Function} {[@var{old_prog}, @var{old_args}] =} gnuplot_binary (@var{new_prog}, @var{arg1}, @dots{})
Query or set the name of the program invoked by the plot command
when the graphics toolkit is set to "gnuplot". Additional arguments to
pass to the external plotting program may also be given.
The default value is @qcode{"gnuplot"} with no additional arguments.
@xref{Installation}.
@seealso{@ref{XREFgraphics_toolkit,,graphics_toolkit}}
@end deftypefn
@c gui_mode libinterp/dldfcn/__init_fltk__.cc
@anchor{XREFgui_mode}
@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()
@deftypefnx {Built-in Function} {} gui_mode (@var{mode})
Query or set the GUI mode for the current graphics toolkit.
The @var{mode} argument can be one of the following strings:
@table @asis
@item @qcode{"2d"}
Allows panning and zooming of current axes.
@item @qcode{"3d"}
Allows rotating and zooming of current axes.
@item @qcode{"none"}
Mouse inputs have no effect.
@end table
This function is currently implemented only for the FLTK graphics toolkit.
@seealso{@ref{XREFmouse_wheel_zoom,,mouse_wheel_zoom}}
@end deftypefn
@c mouse_wheel_zoom libinterp/dldfcn/__init_fltk__.cc
@anchor{XREFmouse_wheel_zoom}
@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()
@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})
@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, "local")
Query or set the mouse wheel zoom factor.
The zoom factor is a number in the range (0,1) which is the percentage of the
current axis limits that will be used when zooming. For example, if the
current x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),
then a zoom operation will change the limits by 20.
When called from inside a function with the @qcode{"local"} option, the
variable is changed locally for the function and any subroutines it calls.
The original variable value is restored when exiting the function.
This function is currently implemented only for the FLTK graphics toolkit.
@seealso{@ref{XREFgui_mode,,gui_mode}}
@end deftypefn
|