term_graph

Crates.ioterm_graph
lib.rsterm_graph
version
sourcesrc
created_at2020-09-11 18:06:33.578759
updated_at2020-09-11 18:06:33.578759
descriptionA library to graph functions in the command line. For a tutorial on getting started, check out the CaspianA1/term-graph repository on Github.
homepage
repositoryhttps://github.com/CaspianA1/term-graph
max_upload_size
id287474
Cargo.toml error:TOML parse error at line 19, column 10 | 19 | readme = true | ^^^^ invalid type: boolean `true`, expected a string
size0
(CaspianA1)

documentation

README

Graph Rust closures in the terminal.

  • Note: the closures used are floating-point.

Here's an example of how to use term-graph:

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

Commit count: 13

cargo fmt