summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/luametafun/luametafun-axis.tex
blob: f9483039ca7623db2bcd3815bcd0a66268d2a5ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
% language=us

\environment luametafun-style

\startcomponent luametafun-axis

\startchapter[title={Axis}]

The axis macro is the result of one of the first experiments with the key|/|value
interface in \METAFUN. Let's show a lot in one example:

\startbuffer[1]
\startMPcode
    draw lmt_axis [
        sx =   5mm, sy =   5mm,
        nx =  20,   ny =  10,
        dx =   5,   dy =   2,
        tx =  10,   ty =  10,

        list = {
            [
                connect = true,
                color   = "darkred",
                close   = true,
                points  = { (1, 1), (15, 8), (2, 10) },
                texts   = { "segment 1", "segment 2", "segment 3" }
            ],
            [
                connect = true,
                color   = "darkgreen",
                points  = { (2, 2), (4, 1), (10, 3), (16, 8), (19, 2) },
                labels  = { "a", "b", "c", "d", "e" }
            ],
            [
                connect = true,
                color   = "darkblue",
                close   = true,
                points  = { (5, 3), (8, 8), (16, 1) },
                labels  = { "1", "2", "3" }
            ]
        },

    ] withpen pencircle scaled 1mm  ;
\stopMPcode
\stopbuffer

\typebuffer[1][option=TEX]

\startplacefigure[reference=axis:1]
    \getbuffer[1]
\stopplacefigure

This macro will probably be extended at some point.

\starttabulate[|T|T|T|p|]
\FL
\BC name         \BC type    \BC default \BC comment \NC \NR
\ML
\NC nx           \NC numeric \NC 1       \NC \NC \NR
\NC dx           \NC numeric \NC 1       \NC \NC \NR
\NC tx           \NC numeric \NC 0       \NC \NC \NR
\NC sx           \NC numeric \NC 1       \NC \NC \NR
\NC startx       \NC numeric \NC 0       \NC \NC \NR
\NC ny           \NC numeric \NC 1       \NC \NC \NR
\NC dy           \NC numeric \NC 1       \NC \NC \NR
\NC ty           \NC numeric \NC 0       \NC \NC \NR
\NC sy           \NC numeric \NC 1       \NC \NC \NR
\NC starty       \NC numeric \NC 0       \NC \NC \NR
\ML                                      \NC \NC \NR
\NC samples      \NC list    \NC         \NC \NC \NR
\NC list         \NC list    \NC         \NC \NC \NR
\NC connect      \NC boolean \NC false   \NC \NC \NR
\NC list         \NC list    \NC         \NC \NC \NR
\NC close        \NC boolean \NC false   \NC \NC \NR
\NC samplecolors \NC list    \NC         \NC \NC \NR
\NC axiscolor    \NC string  \NC         \NC \NC \NR
\NC textcolor    \NC string  \NC         \NC \NC \NR
\LL
\stoptabulate

\stopchapter

\stopcomponent