boxplot_svg/
boxplot_svg.rs

1use plotlib::page::Page;
2use plotlib::repr::BoxPlot;
3use plotlib::style::BoxStyle;
4use plotlib::view::CategoricalView;
5
6fn main() {
7    let b1 = BoxPlot::from_slice(&[1.0, 4.0, 2.0, 3.5, 6.4, 2.5, 7.5, 1.8, 9.6]).label("1");
8    let b2 = BoxPlot::from_slice(&[3.0, 4.3, 2.0, 3.5, 6.9, 4.5, 7.5, 1.8, 10.6])
9        .label("2")
10        .style(&BoxStyle::new().fill("darkolivegreen"));
11
12    let v = CategoricalView::new()
13        .add(b1)
14        .add(b2)
15        .x_label("Experiment")
16        .y_label("y");
17
18    Page::single(&v)
19        .dimensions(400, 300)
20        .save("boxplot.svg")
21        .expect("saving svg");
22}