MCPcopy Create free account
hub / github.com/elftausend/graplot / main

Function main

examples/collatz.rs:3–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1use graplot::{Desc, Plot, PlotArg};
2
3fn main() {
4 let mut plot = Plot::default();
5 plot.set_title("Collatz Conjecture");
6 plot.set_desc(Desc {
7 min_steps_x: 10.,
8 spacing_x: 47.,
9 ..Default::default()
10 });
11
12 for input in 1000..=1001 {
13 let mut single_graph = collatz(input as f64).as_plot();
14 single_graph.set_color(0., 1. * (input == 1000) as i32 as f32, 1.);
15 plot.add(single_graph);
16 }
17 plot.show();
18}
19
20fn collatz(input: f64) -> Vec<f64> {
21 let mut list: Vec<f64> = Vec::new();

Callers

nothing calls this directly

Calls 7

collatzFunction · 0.85
set_colorMethod · 0.80
set_titleMethod · 0.45
set_descMethod · 0.45
as_plotMethod · 0.45
addMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected