Skip to content

Commit eda2542

Browse files
gallery+docs: Update gallery + manual (#182)
2 parents 69a4359 + 94c044d commit eda2542

4 files changed

Lines changed: 60 additions & 2 deletions

File tree

doc/style.typ

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#import "/src/lib.typ"
22

33
#import "@preview/tidy:0.4.3"
4-
#import "@preview/t4t:0.3.2": is
4+
#import "@preview/t4t:0.3.2": is as is_
55

66
#let show-function(fn, style-args) = {
77
[
88
#heading(fn.name, level: style-args.first-heading-level + 1)
99
#label(style-args.label-prefix + fn.name + "()")
1010
]
11-
let description = if is.sequence(fn.description) {
11+
let description = if is_.sequence(fn.description) {
1212
fn.description.children
1313
} else {
1414
(fn.description,)

gallery/normal-dist.png

84.5 KB
Loading

gallery/normal-dist.typ

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#import "@preview/cetz:0.5.2": canvas, draw
2+
#import "@preview/cetz-plot:0.1.4": plot
3+
4+
#set page(width: auto, height: auto, margin: .5cm)
5+
6+
#let style = (stroke: black, fill: rgb(0, 0, 200, 75))
7+
8+
#let f(x, rho: .4, sigma: 0) = 1 / calc.sqrt(2 * calc.pi * rho * rho) * calc.exp(-calc.pow(x - sigma, 2)/(2 * rho * rho))
9+
10+
#set text(size: 10pt, fill: white)
11+
12+
#canvas(background: gray.darken(80%), {
13+
import draw: *
14+
15+
set-style(
16+
axes: (
17+
stroke: 1pt + white,
18+
tick: (stroke: 1pt + white),
19+
fill: gray.darken(60%),
20+
minor-tick: (stroke: white),
21+
grid: (stroke: (thickness: .5pt, paint: white, dash: "dotted")),
22+
),
23+
legend: (
24+
fill: black.transparentize(60%),
25+
stroke: none,
26+
padding: .3cm,
27+
offset: (-.1, -.1)
28+
)
29+
)
30+
31+
let x-format = x => {
32+
if x > 0 { $mu + #{x}sigma$ }
33+
else if x < 0 { $mu - #{calc.abs(x)}sigma$ }
34+
else { $mu$ }
35+
}
36+
37+
plot.plot(size: (12, 8),
38+
x-tick-step: 1,
39+
y-tick-step: 1,
40+
x-format: x-format,
41+
y-max: 1.1,
42+
y-min: -.1,
43+
x-grid: true,
44+
y-grid: true,
45+
x-label: none,
46+
y-label: none,
47+
legend: "inner-north-east",
48+
{
49+
plot.add(f, domain: (-3, +3),
50+
style: (stroke: green),
51+
label: $y = 1/sqrt(2 pi sigma^2) exp(-(x - mu)^2/(2 sigma^2)) $,
52+
samples: 200,
53+
)
54+
})
55+
56+
// Add some padding
57+
rect((-1, -1), (13, 9))
58+
})

manual.pdf

-2 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)