Graph Rust closures in the terminal.
- Note: the closures used are floating-point.
Here's an example of how to use term-graph:
- (Note: further documentation is available here)
use term_graph::*;
fn main() {
let screen = init_screen();
let graph_spot = make_plot_area(&screen, GraphPlacement::_TopMiddle);
let graph_spot_2 = make_plot_area(&screen, GraphPlacement::_TopRight);
let small_wave = |theta: f32| 8.0 * theta.sin();
let big_wave = |theta: f32| 17.0 * theta.tan() + 17.0 * theta.atan();
draw_function(graph_spot, small_wave);
draw_function(graph_spot_2, big_wave);
screen.deinit();
}
Here's what that looks like:
![ASCII-graph](https://camo.githubusercontent.com/de443b01e5967c9c475170943d1e5abf94102cd5836c4e5b1a64d66f70f1c551/68747470733a2f2f692e696d6775722e636f6d2f4d6a78797650712e706e67)