| 1 | use graplot::Plot; |
| 2 | |
| 3 | fn main() { |
| 4 | let plot = Plot::new((|x: f64| x.powf(2.) + 0.5, "r-")); |
| 5 | plot.show(); |
| 6 | |
| 7 | println!("???"); |
| 8 | //---------------------- |
| 9 | |
| 10 | // c ... cyan, - ... solid line, o ... ring marker |
| 11 | let plot = Plot::new(([-4., -3., -3.4, -3.75, -4.1], "c-o")); |
| 12 | plot.show(); |
| 13 | |
| 14 | //---------------------- |
| 15 | |
| 16 | let mut xs = [0.; 20000]; |
| 17 | |
| 18 | let mut add = -10000f64; |
| 19 | for idx in 0..20000 { |
| 20 | xs[idx] = add / 1000.; |
| 21 | add += 1.; |
| 22 | } |
| 23 | |
| 24 | let mut ys = [0.; 20000]; |
| 25 | for (i, y) in ys.iter_mut().enumerate() { |
| 26 | *y = xs[i].powf(2.); |
| 27 | } |
| 28 | |
| 29 | let plot = Plot::new((xs, ys, "-y")); |
| 30 | plot.show(); |
| 31 | } |