Crates.io | simple-plot |
lib.rs | simple-plot |
version | 0.1.2 |
source | src |
created_at | 2022-09-09 00:16:41.454339 |
updated_at | 2022-09-11 10:22:00.325281 |
description | Simple plot for one-dimensional vectors |
homepage | |
repository | https://github.com/kkngsm/simple-plot |
max_upload_size | |
id | 661379 |
size | 262,063 |
Provides a macro plot!() that plots a one-dimensional vector (impl IntoIterator<Item={number}>
) using Plotly.
There is no need for complicated settings; simply pass to plot!() the title of the graph and the vectors you wish to plot, and the graph will be displayed.
The passed vector is plotted with index on the x-axis and elements as values on the y-axis.
In Cargo.toml
[dependencies]
simple-plot = "0.1.0"
let range = 0..100;
let sin_iter = (0..150).map(|x| (x as f32 / 10.0).sin() * 20.0);
let parabola_vec:Vec<i32> = (-10..10).map(|x| x*x - 30).collect();
let cos_vec: Vec<f32> = (0..150).map(|x| (x as f32 / 20.0).cos() * 10.0).collect();
let cos_slcie: &[f32] = &cos_vec;
simple_plot::plot!("title", range, sin_iter, parabola_vec, cos_slcie);
Result
If you need these functions, use plotly