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::{gamma_from_z, Figure, SmithGridOpts, Stroke};

fn main() {
    // Sample S11 sweep: a frequency-dependent impedance Z(f) = R(f) + jX(f),
    // converted to Ī“.
    let n = 60;
    let mut grs = Vec::with_capacity(n);
    let mut gis = Vec::with_capacity(n);
    for i in 0..n {
        let f = i as f64 / (n - 1) as f64;
        let r = 0.4 + 1.6 * f;
        let x = -1.5 + 3.0 * f;
        let (gr, gi) = gamma_from_z(r, x);
        grs.push(gr);
        gis.push(gi);
    }

    let fig = Figure::smith()
        .title("S₁₁ sweep")
        .smith_grid(SmithGridOpts::default())
        .line(&grs, &gis, |s| s.label("Ī“(f)").stroke(Stroke::Solid))
        .legend_bottom_right();

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