-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
👿 bugSomething isn't workingSomething isn't working
Description
#import "@preview/cetz:0.2.2"
#import "@preview/cetz:0.2.2": canvas, plot, draw
#import "@preview/statastic:0.1.0": arrayMedian, arrayStd
#let style = (stroke: black, fill: rgb(0, 0, 200, 75))
#let scores = (10, 43, 55, 96, 200, 370)
#let median = arrayMedian(scores)
#let mean = (scores.map(score => score).sum()) / scores.len()
#let stddev = arrayStd(scores)
#let gaussian(x) = (
1 / (stddev * calc.sqrt(2 * calc.pi)) *
calc.exp(-(calc.pow(x - mean, 2)) / (2 * calc.pow(stddev, 2)))
)
#canvas({
plot.plot(
size: (13,10),
y-tick-step: none,
y-min: 0, // Without this, the range gets set to strange values.
y-max: 4e-3,
{
plot.add(
hypograph: true,
style: style,
domain: (0, 500), x => gaussian(x)
)
plot.add-vline(
median,
)
plot.annotate({
draw.content((median, 0), $pi$, anchor: "west")
})
})
})
Measuring the content
in non-plot dimensions might cause this problem!
Metadata
Metadata
Assignees
Labels
👿 bugSomething isn't workingSomething isn't working