Skip to content

Commit

Permalink
Merge pull request #464 from sharkdp/plotting
Browse files Browse the repository at this point in the history
Basic plotting support
  • Loading branch information
sharkdp authored Sep 13, 2024
2 parents 4756a19 + 1b5ad17 commit b175c31
Show file tree
Hide file tree
Showing 14 changed files with 1,478 additions and 156 deletions.
503 changes: 500 additions & 3 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions examples/interactive/bar_chart.nbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let names = ["Iron", "Copper", "Silver", "Gold", "Platinum"]
let elements = map(element, names)

fn density(e: ChemicalElement) -> MassDensity = e.density

let densities = map(density, elements)

bar_chart(densities) |>
xlabels(names) |>
value_label("Density") |>
show
10 changes: 10 additions & 0 deletions examples/interactive/line_plot.nbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
let A0 = 3 cm
let ω = 20 Hz
let λ = 1.5 s

fn amplitude(t) = A0 exp(-t/λ) cos(ω t)

line_plot(amplitude, 0 s, 8 s) |>
xlabel("Time") |>
ylabel("Amplitude") |>
show
Loading

0 comments on commit b175c31

Please sign in to comment.