Crate preexplorer

source ·
Expand description

Save data and have a glance at it with quick plots. Leave the detailed plotting to other interactive tools like gnuplot.

Do you have a costly process in Rust and want to save the data for postprocessing? Would you like to still have a basic glance to check it and leave fine-tuning of the plot for later? This is the crate for you!

§Philosophy

Rust is great at computing, making the perfect plot takes times and repetition. This repetitive process in search of the perfect plot should be done externally, and does not need Rust computing power. Therefore, once you achieve the data in Rust, save it, have a quick glance, and leave a simple gnuplot-script to start the fine tunning of your perfect plot.

§Remarks

All data will be saved under the folder “target\preexplorer\data” in the main directory. Plot scripts are saved under the foleder “target\preexplorer\plots”.

Recall that you will need to install gnuplot to use the crate at its full potential.

§Examples

Quickly check your results.

use preexplorer::prelude::*;
(0..100).map(|i| i * i)
    .preexplore()
    .set_title("My computations")
    .plot("my_identifier")
    .unwrap();

Check numerical simulations.

use preexplorer::prelude::*;
use rand_distr::Exp1;
use rand::prelude::*;
let simulation_results: Vec<f64> = (0..100).map(|_| thread_rng().sample(Exp1)).collect();
pre::Density::new(simulation_results)
    .set_title("Empirical Exponential 1")
    .plot("my_identifier")
    .unwrap();

Save some data (mostly numerical: matrices, simulation results and related errors, etc).

use preexplorer::prelude::*;
let my_data = vec![0., 1.1, 0.001, 2., 2.3, 0.01, 3., 1.7, 0.02]; // Some data
let dimension = 2;
pre::Data::new(my_data, dimension)
    .set_title("My title")
    .plot_later("my_identifier")
    .unwrap();

Plot some function in a grid.

use preexplorer::prelude::*;
use ndarray::Array;
let grid = Array::linspace(0., 1., 20);
let values = grid.iter().map(|x| x * x);
(grid.iter(), values).preexplore()
    .set_title("My title")
    .plot("my_identifier")
    .unwrap();

Check out the gallery for more.

§Optional features

  • use-serde — Enables serde support.

Re-exports§

Modules§

  • Errors wrapper from writting data.
  • All you ussually need. Easily start preexploring you results.
  • Traits for easy use or self implmentation.

Structs§

Enums§

  • A small collection of all possible styles.

Constants§

Functions§

  • Removes generated artifacts