Created
February 12, 2024 19:23
-
-
Save fancellu/c8b4431cebc3dd5073b61cbb7ac1555a to your computer and use it in GitHub Desktop.
Rust demo of rasciigraph, which plots simple ascii graphs, quite nice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rand::Rng; | |
use rasciigraph::{plot, Config}; | |
fn main() { | |
let vec = (0..70) | |
.map(|_| rand::thread_rng().gen::<f64>() * 13.0 - 3.0) | |
.collect::<Vec<_>>(); | |
let plot = plot( | |
vec, | |
Config::default() | |
.with_offset(10) | |
.with_height(10) | |
.with_caption("Random values".to_string()), | |
); | |
println!("{}", plot) | |
} |
Author
fancellu
commented
Feb 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment