use bland::{Figure, Hatch, PaperSize};
fn main() {
let control: Vec<f64> = (0..30)
.map(|i| 5.0 + ((i as f64 * 0.43) % 1.0 - 0.5) * 3.0)
.collect();
let mut treated: Vec<f64> = (0..30)
.map(|i| 7.0 + ((i as f64 * 0.71 + 0.1) % 1.0 - 0.5) * 4.0)
.collect();
treated.push(15.0);
let groups = vec![
("control".to_string(), control),
("treated".to_string(), treated),
];
let fig = Figure::new()
.size(PaperSize::A5Landscape)
.title("Distribution by group")
.ylabel("response")
.boxplot(&groups, |b| b.hatch(Hatch::Diagonal).label("Q1–Q3"))
.legend_top_right();
std::fs::create_dir_all("out").expect("create out/");
std::fs::write("out/boxplot.svg", fig.to_svg()).expect("write svg");
println!("wrote out/boxplot.svg");
}