#plot #chart #vector

simple-plot

Simple plot for one-dimensional vectors

3 releases

0.1.2 Sep 11, 2022
0.1.1 Sep 9, 2022
0.1.0 Sep 9, 2022

#375 in Visualization

Download history 7/week @ 2024-07-19 23/week @ 2024-07-26 2/week @ 2024-09-06 1/week @ 2024-09-13 22/week @ 2024-09-20 51/week @ 2024-09-27 16/week @ 2024-10-04 26/week @ 2024-10-11 19/week @ 2024-10-18 9/week @ 2024-10-25

56 downloads per month

MIT/Apache

195KB

simple-plot

Latest version Documentation MIT

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.

Usage/Examples

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 result

What this library cannot do

  • Changing the value of the x-axis
  • Changing the color of a graph etc.

If you need these functions, use plotly

Dependencies

~10MB
~134K SLoC