Skip to content

Commit 87bbdbe

Browse files
committed
[docs] improvements for axis
1 parent ac72af9 commit 87bbdbe

File tree

1 file changed

+53
-4
lines changed

1 file changed

+53
-4
lines changed

src/model/axis.typ

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,67 @@
1818

1919

2020
/// An axis for a diagram. Visually, an axis consists of a _spine_ along the axis
21-
/// direction, a collection of _ticks_ (and subticks) and an _axis label_.
21+
/// direction, a collection of _ticks_ (and subticks) with _tick labels_ and an
22+
/// _axis label_.
23+
/// ```typ render
24+
/// #import "@preview/tiptoe:0.4.0"
25+
/// #let line = lq.line.with(tip: tiptoe.straight, stroke: red + .5pt, clip: false)
26+
/// #set text(1.2em)
2227
///
23-
/// By default, a @diagram features two axes: an x and a y axis which can be
24-
/// configured directly through @diagram.xaxis and @diagram.yaxis. However, it is
25-
/// also possible to add more axes, please refer to the
28+
/// #lq.diagram(
29+
/// yaxis: none,
30+
/// xaxis: (mirror: none, exponent: 1),
31+
/// xlim: (10, 50),
32+
/// ylim: (-.1, 1),
33+
/// grid: none,
34+
/// height: 1cm,
35+
/// width: 7cm,
36+
/// lq.place(16.5, .7, align: right, text(red)[_ticks_]),
37+
/// line((17, .6), (20,0.1)),
38+
/// line((17, .6), (30,0.1)),
39+
/// lq.place(39, .7, align: right, text(red)[_subticks_]),
40+
/// line((39.5, .6), (42,0)),
41+
/// line((39.5, .6), (44,0)),
42+
/// lq.place(60, .7, text(red)[_exponent_]),
43+
/// line((62, .4), (59,-.1)),
44+
/// lq.place(38, -1.5, align: left, text(red)[_axis label_]),
45+
/// line((37, -1.5), (31,-1.3)),
46+
/// lq.place(23, -1.5, text(red)[_tick label_]),
47+
/// line((23, -1.2), (21,-.8)),
48+
/// lq.place(12, -1.5, text(red)[_spine_]),
49+
/// line((12, -1.2), (15,-.1)),
50+
/// xlabel: $x$
51+
/// )
52+
/// ```
53+
///
54+
/// Most often, you will want to configure the main $x$ and $y$ axes by
55+
/// applying the parameters listed here to @diagram.xaxis and @diagram.yaxis:
56+
/// ```typ
57+
/// // Scoped configuration
58+
/// #show: lq.set-diagram(
59+
/// yaxis: (exponent: 0),
60+
/// xaxis: (position: top)
61+
/// )
62+
///
63+
/// // Per-diagram configuration
64+
/// #lq.diagram(
65+
/// yaxis: (exponent: 0),
66+
/// xaxis: (position: top),
67+
/// ..
68+
/// )
69+
/// ```
70+
///
71+
/// However, it is also possible to add more axes, please refer to the
2672
/// #link("tutorials/axis")[axis tutorial] for more details.
2773
///
74+
///
75+
///
2876
/// The built-in _tick formatters_ use the Typst package
2977
/// #link("https://typst.app/universe/package/zero")[Zero] for displaying
3078
/// numbers. This makes it possible to define a consistent number format
3179
/// throughout the entire document, including tables, in-text quantities,
3280
/// and figures.
81+
///
3382
#let axis(
3483

3584
/// Sets the scale of the axis. This may be a @scale object or the name of

0 commit comments

Comments
 (0)