use bland::{Figure, Hatch, PaperSize};
fn main() {
let cats = ["A", "B", "C", "D"];
let fig = Figure::new()
.size(PaperSize::A5Landscape)
.title("Test bench results")
.xlabel("specimen")
.ylabel("yield (MPa)")
.bar(&cats, &[320.0, 290.0, 410.0, 355.0], |b| {
b.label("trial 1").hatch(Hatch::Diagonal).group(0)
})
.bar(&cats, &[345.0, 305.0, 395.0, 380.0], |b| {
b.label("trial 2").hatch(Hatch::Crosshatch).group(1)
})
.legend_top_left();
std::fs::create_dir_all("out").expect("create out/");
std::fs::write("out/bar_grouped.svg", fig.to_svg()).expect("write svg");
println!("wrote out/bar_grouped.svg");
}