bland 0.2.1

Pure-Rust library for paper-ready, monochrome, hatch-patterned technical plots in the visual tradition of 1960s-80s engineering reports.
Documentation
use bland::{Figure, PaperSize};

fn main() {
    // 40 × 40 grid: 2D Gaussian centered at origin, span [-2, 2].
    let n = 40;
    let grid: Vec<Vec<f64>> = (0..n)
        .map(|j| {
            let y = -2.0 + 4.0 * j as f64 / (n - 1) as f64;
            (0..n)
                .map(|i| {
                    let x = -2.0 + 4.0 * i as f64 / (n - 1) as f64;
                    (-(x * x + y * y) / 0.6).exp()
                })
                .collect()
        })
        .collect();

    let edges: Vec<f64> = (0..=n)
        .map(|i| -2.0 + 4.0 * i as f64 / n as f64)
        .collect();

    let fig = Figure::new()
        .size(PaperSize::Square)
        .title("2D Gaussian density")
        .xlabel("x")
        .ylabel("y")
        .heatmap(grid, |h| {
            h.x_edges(edges.clone())
                .y_edges(edges.clone())
                .label("density")
        });

    std::fs::create_dir_all("out").expect("create out/");
    std::fs::write("out/heatmap.svg", fig.to_svg()).expect("write svg");
    println!("wrote out/heatmap.svg");
}