Skip to content

Commit

Permalink
Improve manual
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesrswift committed Aug 1, 2024
1 parent 6d140f8 commit 79019f2
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 19 deletions.
59 changes: 43 additions & 16 deletions doc/style.typ
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,50 @@
if type(types) != array {
types = (types,)
}
stack(dir: ttb, spacing: 1em,
// name <type> Default: <default>
block(breakable: false, width: 100%, stack(dir: ltr,
[#text(weight: "bold", name + [:]) #types.map(tidy.styles.default.show-type).join(" or ")],
if show-default {
align(right)[
Default: #raw(
lang: "typc",
// Tidy gives defaults as strings but outside of tidy we pass defaults as the actual values
if in-tidy { default } else { repr(default) }
)
]
}
)),
// text
block(inset: (left: .4cm), content)

block(
breakable: false,
above: 1em, below: 2em, spacing: 1em,
{
block({
box(heading(name, level: 4))
[:]
[#types.map(tidy.styles.default.show-type).join(" or ")]
h(1fr)
if show-default {
[Default: ]
raw(
lang: "typc",
// Tidy gives defaults as strings but outside of tidy we pass defaults as the actual values
if in-tidy { default } else { repr(default) }
)
}
})
block(inset: (left: .4cm), content)
}
)

// block(
// breakable: false,
// above: 1em, below: 2em, spacing: 1em,
// stack(
// dir: ttb, spacing: 1em,
// // name <type> Default: <default>
// block(breakable: false, width: 100%, stack(dir: ltr,
// [#text(weight: "bold", box(heading(name, level: 4)) + [:]) #types.map(tidy.styles.default.show-type).join(" or ")],
// if show-default {
// align(right)[
// Default: #raw(
// lang: "typc",
// // Tidy gives defaults as strings but outside of tidy we pass defaults as the actual values
// if in-tidy { default } else { repr(default) }
// )
// ]
// }
// )),
// // text
// block(inset: (left: .4cm), content)
// ))
}
Expand Down
Binary file modified manual.pdf
Binary file not shown.
32 changes: 29 additions & 3 deletions manual.typ
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// Outline
#{
show heading: none
columns(2, outline(indent: true, depth: 3))
outline(indent: true, depth: 3)
pagebreak(weak: true)
}

Expand Down Expand Up @@ -63,17 +63,43 @@ You can use the following options to customize each axis of the plot. You must p

#doc-style.show-parameter-block("label", ("none", "content"), default: none)[
The axis' label. If and where the label is drawn depends on the `axis-style`.
#example(```
cetz-plot.plot(
size: (5,5),
x-label: [My $x$-label],
y-label: [Intensity [$"cts"$]],
{
cetz-plot.add.xy(
domain: (0, 2 * calc.pi),
t => (calc.cos(t), calc.sin(t))
)
}
)
```)
]

#doc-style.show-parameter-block("min", ("auto", "float"), default: auto)[
Axis lower domain value. If this is set greater than than `max`, the axis' direction is swapped
#example(```
cetz-plot.plot(
size: (5,5),
x-min: -5, x-max: 5,
y-min: -2,
{
cetz-plot.add.xy(
domain: (0, 2 * calc.pi),
t => (calc.cos(t), calc.sin(t))
)
}
)
```)
]

#doc-style.show-parameter-block("max", ("auto", "float"), default: auto)[
Axis upper domain value. If this is set to a lower value than `min`, the axis' direction is swapped
]

#doc-style.show-parameter-block("equal", ("string"), default: "none")[
#doc-style.show-parameter-block("equal", ("string"), default: none)[
Set the axis domain to keep a fixed aspect ratio by multiplying the other axis domain by the plots aspect ratio,
depending on the other axis orientation (see `horizontal`).
This can be useful to force one axis to grow or shrink with another one.
Expand Down Expand Up @@ -173,7 +199,7 @@ You can use the following options to customize each axis of the plot. You must p
The base to be used when labeling axis ticks in logarithmic scaling
]

#doc-style.show-parameter-block("grid", ("bool", "string"), default: "false")[
#doc-style.show-parameter-block("grid", ("bool", "string"), default: false)[
If `true` or `"major"`, show grid lines for all major ticks. If set
to `"minor"`, show grid lines for minor ticks only.
The value `"both"` enables grid lines for both, major- and minor ticks.
Expand Down
8 changes: 8 additions & 0 deletions src/plot.typ
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@
/// )
/// ```
/// - axis-style (axis-style-module): TODO: Make this link to the axis-style section
/// ```example
/// cetz-plot.plot(
/// size: (5,5),
/// axis-style: cetz-plot.axis-style.polar-2d,
/// x-grid: "both", y-grid: "both",
/// {cetz-plot.add.xy(calc.sin, domain: (0,2*calc.pi))}
/// )
/// ```
/// - name (string, none): The plots element name to be used when referring to anchors
/// - plot-style (style,function): Styling to use for drawing plot graphs.
/// This style gets inherited by all plots and supports `palette` functions.
Expand Down

0 comments on commit 79019f2

Please sign in to comment.