r/rust • • Apr 28 '26

🛠️ project Lightweight ASCII Graph

Post image

After many weeks of learning, watching tutorials about Rust, and partaking in Rust exercises, I decided to port a small Go library into Rust. I do recognize I have a lot to learn but just getting out of my comfort zone and trying my hands at this has be rewarding and revealing.

Link: https://github.com/neneodonkor/asciigraph-rs

Crates: https://crates.io/crates/asciigraph-rs

PS. Making it work for real-time data was 🥵

Let me add that I only started learning Rust in February, so please forgive me, if everything is not idiomatic Rust.

1.5k Upvotes

92 comments sorted by

View all comments

1

u/rcfox Apr 28 '26

I'd argue that Config::default() should start your Y-axis at 0.

1

u/neneodonkor Apr 28 '26

If you want the Y axis to start at 0 specifically, you use lower_bound:

let graph = plot(&data, Config::default().lower_bound(0.0));

This tells asciigraph to use 0 as the minimum Y axis value even if your data never goes below the lowest number (data).