|
28 | 28 | x-min: -360,
|
29 | 29 | x-max: 360,
|
30 | 30 | y-tick-step: 1,
|
31 |
| - x2-label: none, |
32 |
| - x2-min: -90, |
33 |
| - x2-max: 90, |
34 |
| - x2-tick-step: 45, |
35 |
| - x2-minor-tick-step: 15, |
36 |
| - y2-label: none, |
37 |
| - y2-min: -1.5, |
38 |
| - y2-max: 1.5, |
39 |
| - y2-tick-step: .5, |
40 |
| - y2-minor-tick-step: .1, |
| 31 | + u-label: none, |
| 32 | + u-min: -90, |
| 33 | + u-max: 90, |
| 34 | + u-tick-step: 45, |
| 35 | + u-minor-tick-step: 15, |
| 36 | + v-label: none, |
| 37 | + v-min: -1.5, |
| 38 | + v-max: 1.5, |
| 39 | + v-tick-step: .5, |
| 40 | + v-minor-tick-step: .1, |
41 | 41 | {
|
42 | 42 | plot.add(data)
|
43 |
| - plot.add(data, style: (stroke: blue), axes: ("x2", "y2")) |
| 43 | + plot.add(data, style: (stroke: blue), axes: ("u", "v")) |
44 | 44 | })
|
45 | 45 | })
|
46 | 46 |
|
47 | 47 | /* School-Book Style */
|
48 | 48 | #test-case({
|
49 | 49 | plot.plot(size: (5, 4),
|
50 |
| - axis-style: "school-book", |
| 50 | + template: "school-book", |
51 | 51 | x-tick-step: 180,
|
52 | 52 | y-tick-step: 1,
|
53 | 53 | {
|
|
58 | 58 | /* Clipping */
|
59 | 59 | #test-case({
|
60 | 60 | plot.plot(size: (5, 4),
|
61 |
| - axis-style: "school-book", |
| 61 | + template: "school-book", |
62 | 62 | x-min: auto,
|
63 | 63 | x-max: 350,
|
64 | 64 | x-tick-step: 180,
|
|
75 | 75 | plot.plot(size: (5, 4),
|
76 | 76 | x-label: [Rainbow],
|
77 | 77 | x-tick-step: none,
|
78 |
| - axis-style: "scientific", |
79 | 78 | y-label: [Color],
|
80 | 79 | y-max: 8,
|
81 | 80 | y-tick-step: none,
|
|
92 | 91 | /* Tick Step Calculation */
|
93 | 92 | #test-case({
|
94 | 93 | plot.plot(size: (12, 4),
|
95 |
| - y2-decimals: 4, |
| 94 | + v-format: plot.formats.decimal.with(digits: 4), |
96 | 95 | {
|
97 | 96 | plot.add(((0,0), (1,10)), axes: ("x", "y"))
|
98 |
| - plot.add(((0,0), (.1,.01)), axes: ("x2", "y2")) |
| 97 | + plot.add(((0,0), (.1,.01)), axes: ("u", "v")) |
99 | 98 | })
|
100 | 99 | })
|
101 | 100 |
|
102 | 101 | #test-case({
|
103 | 102 | plot.plot(size: (12, 4),
|
104 |
| - y2-decimals: 9, |
105 |
| - x2-decimals: 9, |
106 |
| - y2-format: "sci", |
| 103 | + v-format: plot.formats.sci, |
| 104 | + u-format: plot.formats.sci, |
107 | 105 | {
|
108 | 106 | plot.add(((0,0), (30,2500)), axes: ("x", "y"))
|
109 |
| - plot.add(((0,0), (.001,.0001)), axes: ("x2", "y2")) |
| 107 | + plot.add(((0,0), (.001,.0001)), axes: ("u", "v")) |
110 | 108 | })
|
111 | 109 | })
|
112 | 110 |
|
113 |
| -/* Axis Styles */ |
114 |
| - |
115 |
| - |
| 111 | +/* Templates */ |
116 | 112 | #test-case(args => {
|
117 | 113 | plot.plot(size: (4,4), x-tick-step: 90, y-tick-step: 1,
|
118 |
| - axis-style: args, { |
| 114 | + template: args, { |
119 | 115 | plot.add(domain: (0, 360), x => calc.sin(x * 1deg))
|
120 | 116 | })
|
121 | 117 | }, args: (
|
122 |
| - "scientific", "scientific-auto", "left", "school-book", none |
| 118 | + // TODO |
| 119 | + //"scientific", "scientific-auto", "left", "school-book", none |
| 120 | + "scientific", "school-book" |
123 | 121 | ))
|
124 | 122 |
|
125 | 123 | /* Manual Axis Bounds */
|
|
136 | 134 | yb-min: -1.5, yb-max: .5,
|
137 | 135 | yt-min: -.5, yt-max: 1.5,
|
138 | 136 | {
|
139 |
| - plot.add-cartesian-axis("xl", (0, 0), (4, 0)) |
140 |
| - plot.add-cartesian-axis("xr", (0, 4), (4, 4)) |
141 |
| - plot.add-cartesian-axis("yt", (0, 0), (0, 4)) |
142 |
| - plot.add-cartesian-axis("yb", (4, 0), (4, 4)) |
| 137 | + plot.lin-axis("xl") |
| 138 | + plot.lin-axis("xr") |
| 139 | + plot.lin-axis("yt") |
| 140 | + plot.lin-axis("yb") |
143 | 141 | plot.add(circle-data)
|
144 | 142 | plot.add(circle-data, axes: ("xl", "y"), style: (stroke: green))
|
145 | 143 | plot.add(circle-data, axes: ("xr", "y"), style: (stroke: red))
|
|
159 | 157 | yb-min: -1.75, yb-max: .25,
|
160 | 158 | yt-min: -.25, yt-max: 1.75,
|
161 | 159 | {
|
162 |
| - plot.add-cartesian-axis("xl", (0, 0), (4, 0)) |
163 |
| - plot.add-cartesian-axis("xr", (0, 4), (4, 4)) |
164 |
| - plot.add-cartesian-axis("yt", (0, 0), (0, 4)) |
165 |
| - plot.add-cartesian-axis("yb", (4, 0), (4, 4)) |
| 160 | + plot.lin-axis("xl") |
| 161 | + plot.lin-axis("xr") |
| 162 | + plot.lin-axis("yt") |
| 163 | + plot.lin-axis("yb") |
166 | 164 | plot.add(circle-data)
|
167 | 165 | plot.add(circle-data, axes: ("xl", "y"), style: (stroke: green))
|
168 | 166 | plot.add(circle-data, axes: ("xr", "y"), style: (stroke: red))
|
|
198 | 196 | mark: (start: ">", end: ">"), name: "amplitude")
|
199 | 197 | })
|
200 | 198 |
|
201 |
| -/* Custom sample points */ |
202 |
| -#test-case({ |
203 |
| - plot.plot(size: (6, 4), y-min: -2, y-max: 2, |
204 |
| - samples: 10, |
205 |
| - { |
206 |
| - plot.add(samples: 2, sample-at: (.99, 1.001, 1.99, 2.001, 2.99), domain: (0, 3), |
207 |
| - x => calc.pow(-1, int(x))) |
208 |
| - }) |
209 |
| -}) |
210 |
| - |
211 | 199 | /* Format tick values */
|
212 | 200 | #test-case({
|
213 | 201 | plot.plot(size: (6, 4),
|
|
217 | 205 | y-tick-step: none,
|
218 | 206 | y-ticks: (-1, 0, 1),
|
219 | 207 | y-format: x => $y_(#x)$,
|
220 |
| - x2-tick-step: none, |
221 |
| - x2-ticks: (-1, 0, 1), |
222 |
| - x2-format: x => $x_(2,#x)$, |
223 |
| - y2-tick-step: none, |
224 |
| - y2-ticks: (-1, 0, 1), |
225 |
| - y2-format: x => $y_(2,#x)$, |
| 208 | + u-tick-step: none, |
| 209 | + u-ticks: (-1, 0, 1), |
| 210 | + u-format: x => $x_(2,#x)$, |
| 211 | + v-tick-step: none, |
| 212 | + v-ticks: (-1, 0, 1), |
| 213 | + v-format: x => $y_(2,#x)$, |
226 | 214 | {
|
227 | 215 | plot.add(samples: 2, domain: (-1, 1), x => -x, axes: ("x", "y"))
|
228 |
| - plot.add(samples: 2, domain: (-1, 1), x => x, axes: ("x2", "y2")) |
| 216 | + plot.add(samples: 2, domain: (-1, 1), x => x, axes: ("u", "v")) |
229 | 217 | })
|
230 | 218 | })
|
231 | 219 |
|
232 | 220 | // Test plot with anchors only
|
| 221 | +/* |
233 | 222 | #test-case({
|
234 | 223 | import draw: *
|
235 | 224 |
|
|
256 | 245 | tick: (
|
257 | 246 | length: -.1,
|
258 | 247 | ),
|
259 |
| - left: ( |
| 248 | + y: ( |
260 | 249 | stroke: (paint: red),
|
261 | 250 | tick: (
|
262 | 251 | stroke: auto,
|
263 | 252 | )
|
264 | 253 | ),
|
265 |
| - bottom: ( |
| 254 | + x: ( |
266 | 255 | stroke: (paint: blue, thickness: 2pt),
|
267 | 256 | tick: (
|
268 | 257 | stroke: auto,
|
|
0 commit comments