luametafun-axis.tex /size: 2559 b    last modification: 2021-10-28 13:50
1% language=us runpath=texruns:manuals/luametafun
2
3\environment luametafun-style
4
5\startcomponent luametafun-axis
6
7\startchapter[title={Axis}]
8
9The axis macro is the result of one of the first experiments with the key|/|value
10interface in \METAFUN. Let's show a lot in one example:
11
12\startbuffer[1]
13\startMPcode
14    draw lmt_axis [
15        sx =   5mm, sy =   5mm,
16        nx =  20,   ny =  10,
17        dx =   5,   dy =   2,
18        tx =  10,   ty =  10,
19
20        list = {
21            [
22                connect = true,
23                color   = "darkred",
24                close   = true,
25                points  = { (1, 1), (15, 8), (2, 10) },
26                texts   = { "segment 1", "segment 2", "segment 3" }
27            ],
28            [
29                connect = true,
30                color   = "darkgreen",
31                points  = { (2, 2), (4, 1), (10, 3), (16, 8), (19, 2) },
32                labels  = { "a", "b", "c", "d", "e" }
33            ],
34            [
35                connect = true,
36                color   = "darkblue",
37                close   = true,
38                points  = { (5, 3), (8, 8), (16, 1) },
39                labels  = { "1", "2", "3" }
40            ]
41        },
42
43    ] withpen pencircle scaled 1mm  ;
44\stopMPcode
45\stopbuffer
46
47\typebuffer[1][option=TEX]
48
49\startplacefigure[reference=axis:1]
50    \getbuffer[1]
51\stopplacefigure
52
53This macro will probably be extended at some point.
54
55\starttabulate[|T|T|T|p|]
56\FL
57\BC name         \BC type    \BC default \BC comment \NC \NR
58\ML
59\NC nx           \NC numeric \NC 1       \NC \NC \NR
60\NC dx           \NC numeric \NC 1       \NC \NC \NR
61\NC tx           \NC numeric \NC 0       \NC \NC \NR
62\NC sx           \NC numeric \NC 1       \NC \NC \NR
63\NC startx       \NC numeric \NC 0       \NC \NC \NR
64\NC ny           \NC numeric \NC 1       \NC \NC \NR
65\NC dy           \NC numeric \NC 1       \NC \NC \NR
66\NC ty           \NC numeric \NC 0       \NC \NC \NR
67\NC sy           \NC numeric \NC 1       \NC \NC \NR
68\NC starty       \NC numeric \NC 0       \NC \NC \NR
69\ML                                      \NC \NC \NR
70\NC samples      \NC list    \NC         \NC \NC \NR
71\NC list         \NC list    \NC         \NC \NC \NR
72\NC connect      \NC boolean \NC false   \NC \NC \NR
73\NC list         \NC list    \NC         \NC \NC \NR
74\NC close        \NC boolean \NC false   \NC \NC \NR
75\NC samplecolors \NC list    \NC         \NC \NC \NR
76\NC axiscolor    \NC string  \NC         \NC \NC \NR
77\NC textcolor    \NC string  \NC         \NC \NC \NR
78\LL
79\stoptabulate
80
81\stopchapter
82
83\stopcomponent
84