5 releases (breaking)

Uses new Rust 2024

0.5.0 Mar 1, 2025
0.4.0 Oct 23, 2024
0.3.0 Oct 21, 2024
0.2.0 Oct 19, 2024
0.1.0 Jul 24, 2021

#82 in Visualization

Download history 2/week @ 2024-12-08 4/week @ 2025-02-02 4/week @ 2025-02-09 2/week @ 2025-02-16 67/week @ 2025-02-23 90/week @ 2025-03-02 3/week @ 2025-03-09

160 downloads per month

MIT/Apache

47KB
1.5K SLoC

splot

Rust crate for plotting to SVG / HTML

  • Styling with CSS
  • Usable in WebAssembly

Line Plot to SVG

use splot::{Chart, Domain, Edge, Plot};

let data = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
let chart = Chart::new()
    .title("Line Plot")
    .domain(Domain::from(&data[..]).set_x(&[0.0, 200.0]))
    .axis("X Axis", Edge::Bottom)
    .axis("Y Axis", Edge::Left)
    .plot(Plot::line("Series", &data).label());
print!("{chart}");

Scatter Plot to HTML

use splot::{Chart, Edge, Page, Plot};

let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
let page = Page::new().chart(
    Chart::new()
        .title("Scatter Plot")
        .domain(&data_a[..])
        .axis("X Axis", Edge::Bottom)
        .axis("Y Axis", Edge::Left)
        .axis("", Edge::Right)
        .plot(Plot::scatter("Series A", &data_a).label())
        .plot(Plot::scatter("Series B", &data_b)),
);
print!("{page}");

No runtime deps