Skip to content

DeltaManiac/rascii

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rasciigraph

Rascii graph is a rust implementation of asciietch.

It follows the same principals of trying to draw graph with simple characters

Runs on Rust nightly as it uses the Iterator::step_by trait.

Examples

Plotting from the first 7 integers in a decreasing order

rasciigraph::grapher::graph(vec![7.0, 6.0, 5.0, 4.5, 3.5, 2.7, 1_f64], None, None);
* Upper Value :7.00 ****************************************************************************************************************************************************************
-
 \
  \
   \
    \
     \
      |
      -
* Lower Value :1.00 * Mean:4.24* Std Dev:2.03***************************************************************************************************************************************

Plotting Sine Wave times ten

let mut rand_vec = Vec::new();
    for i in 0..360 {
        rand_vec.push(f64::sin(i as f64) * 10.0);
    }
    rasciigraph::grapher::graph(rand_vec, None, None);
* Upper Value :10.00 ***************************************************************************************************************************************************************
       -  -  -               -  -  -  -            -  -  -  -            -  -  -  -            -  -  -  -            -  -  -  -            -  -  -  -               -  -  -
    -  || || || -  -      -  || || || || -      -  || || || || -      -  || || || || -      -  || || || || -      -  || || || || -      -  || || || || -      -  -  || || || -
--  || || || || || || --  || || || || || || --  || || || || || || --  || || || || || || --  || || || || || || --  || || || || || || --  || || || || || || --  || || || || || || --
  | || || || || || |\ | |/ | || || || || |\ | |/ | || || || || |\ | |/ | || || || || |\ | |/ | || || || || |\ | |/ | || || || || |\ | |/ | || || || || |\ | |/ | || || || || || | |-
  |/ | || || || |\ | || || | || || || |\ | || || | || || || |\ | || || | || || || |\ | || || |/ | || || || | || || |/ | || || || | || || |/ | || || || | || || |/ | || || || |\ | ||
  || |/ | || || | || || || |/ | || || | || || || |/ | || || | || || || |/ | || || | || || || || | || || |\ | || || || | || || |\ | || || || | || || |\ | || || || | || || |\ | || ||
  || || |/ | |\ | || || || || |/ | |\ | || || || || |/ | |\ | || || || || |/ | |\ | || || || || |/ | |\ | || || || || |/ | |\ | || || || || |/ | |\ | || || || || |/ | |\ | || || ||
  || || || -/  || || || || || || -/  || || || || || || -/  || || || || || || -/  || || || || || || -/  || || || || || || -/  || || || || || || -/  || || || || || || -/  || || || ||
  || -  -      -  || || || || -      -  || || || || -      -  || || || || -      -  || || || || -      -  || || || || -      -  || || || || -      -  || || || || -      -  -  || ||
  -               -  -  -  -            -  -  -  -            -  -  -  -            -  -  -  -            -  -  -  -            -  -  -  -            -  -  -  -               -  -
* Lower Value :-10.00 * Mean:0.02* Std Dev:7.07*************************************************************************************************************************************

Plotting some Random Values without height and width constraints

rasciigraph::grapher::graph(
        vec![
            7.2, 7.3, 7.4, 6.4, 5.2, 5.0, 5.1, 5.9, 5.7, 4.2, 3.3, 2.6, 72.0, 2.1, 2.3, 3.2, 6.2,
            2.2, 1.1,
    ],
        None,
        None,
        );
* Upper Value :72.00 ***************************************************************************************************************************************************************
            -
            ||
            ||
            ||
            ||
            ||
            ||
            ||
            ||
            ||
            ||
            ||
            ||
            ||
            ||
            ||
            ||
            ||
---         ||
   -------- || --
           - -/  --
* Lower Value :1.10 * Mean:8.13* Std Dev:15.59**************************************************************************************************************************************

Plotting some Random Values with height and width constraints

rasciigraph::grapher::graph(
        vec![
            7.2, 7.3, 7.4, 6.4, 5.2, 5.0, 5.1, 5.9, 5.7, 4.2, 3.3, 2.6, 72.0, 2.1, 2.3, 3.2, 6.2,
            2.2, 1.1,
        ],
        Some(10),
        Some(10),
    );
* Upper Value :72.00
      -
      ||
      ||
      ||
      ||
      ||
      ||
      ||
--    ||
  ---/ |-
       - -
* Lower Value :1.10 * Mean:8.13* Std Dev:15.59

More examples here

To run examples execute

cargo run --example hello

Releases

No releases published

Packages

No packages published

Languages