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::{bode, BodeOpts};

fn main() {
    // First-order low-pass: H(s) = 1 / (1 + s/10).
    // |H(jω)|² = 1 / (1 + ω²/100); ∠H = -atan(ω/10).
    let omegas: Vec<f64> = (0..401)
        .map(|i| 10f64.powf(-1.0 + 4.0 * i as f64 / 400.0))
        .collect();

    let mag_db: Vec<f64> = omegas
        .iter()
        .map(|w| -10.0 * (1.0 + w * w / 100.0).log10())
        .collect();
    let phase_deg: Vec<f64> = omegas
        .iter()
        .map(|w| -(w / 10.0).atan() * 180.0 / std::f64::consts::PI)
        .collect();

    let svg = bode(
        &omegas,
        &mag_db,
        &phase_deg,
        BodeOpts::default()
            .title("First-order low-pass H(s) = 1/(1+s/10)")
            .cell_size(900.0, 320.0),
    );

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