Struct preexplorer::Density
source · pub struct Density<T>{ /* private fields */ }
Expand description
A type to a histogram: point cloud, probability density, cummulative probability distribution and/or bins.
§Examples
Quick plot.
use preexplorer::prelude::*;
pre::Density::new((0..10)).plot("my_identifier").unwrap();
Compare Density structs.
use preexplorer::prelude::*;
pre::Densities::new(vec![
pre::Density::new((0..10)),
pre::Density::new((0..10)),
])
.plot("my_identifier").unwrap();
Implementations§
source§impl<T> Density<T>
impl<T> Density<T>
sourcepub fn new<I>(realizations: I) -> Density<T>where
I: IntoIterator<Item = T>,
pub fn new<I>(realizations: I) -> Density<T>where
I: IntoIterator<Item = T>,
Constructs a new Density<T>
.
§Examples
From a simulation.
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();
sourcepub fn set_cdf(&mut self, cdf: bool) -> &mut Self
pub fn set_cdf(&mut self, cdf: bool) -> &mut Self
Controls the plotting of the cummulative density function (cdf). If true, it will appear in the plotting, otherwise it will not.
§Default
The default value is true.
let mut den = pre::Density::new((0..10));
assert_eq!(den.cdf(), true);
den.set_cdf(false);
assert_eq!(den.cdf(), false);
sourcepub fn set_pdf(&mut self, pdf: bool) -> &mut Self
pub fn set_pdf(&mut self, pdf: bool) -> &mut Self
Controls the plotting of the probability density function (pdf). If true, it will appear in the plotting, otherwise it will not.
§Default
The default value is true.
let mut den = pre::Density::new((0..10));
assert_eq!(den.pdf(), true);
den.set_pdf(false);
assert_eq!(den.pdf(), false);
sourcepub fn set_cloud(&mut self, cloud: bool) -> &mut Self
pub fn set_cloud(&mut self, cloud: bool) -> &mut Self
Controls the plotting of the point cloud. If true, it will appear in the plotting, otherwise it will not.
§Default
The default value is true.
let mut den = pre::Density::new((0..10));
assert_eq!(den.cloud(), true);
den.set_cloud(false);
assert_eq!(den.cloud(), false);
sourcepub fn set_bins(&mut self, bins: bool) -> &mut Self
pub fn set_bins(&mut self, bins: bool) -> &mut Self
Controls the plotting of bins representation of the density. If true, it will appear in the plotting, otherwise it will not.
§Default
The default value is true.
§Remarks
The number of bins is controlled in gnuplot. Refer to the gnuplot documentation,
you want to search for the bins
, under the Data
section.
let mut den = pre::Density::new((0..10));
assert_eq!(den.bins(), true);
den.set_bins(false);
assert_eq!(den.bins(), false);
pub fn cloud(&self) -> bool
pub fn pdf(&self) -> bool
pub fn cdf(&self) -> bool
pub fn bins(&self) -> bool
Trait Implementations§
source§impl<T> AddAssign<Density<T>> for Densities<T>
impl<T> AddAssign<Density<T>> for Densities<T>
source§fn add_assign(&mut self, other: Density<T>)
fn add_assign(&mut self, other: Density<T>)
+=
operation. Read moresource§impl<T> Configurable for Density<T>
impl<T> Configurable for Density<T>
source§fn configuration_mut(&mut self) -> &mut Configuration
fn configuration_mut(&mut self) -> &mut Configuration
Configuration
.source§fn configuration(&self) -> &Configuration
fn configuration(&self) -> &Configuration
Configuration
.source§fn set_title<S: Display>(&mut self, title: S) -> &mut Self
fn set_title<S: Display>(&mut self, title: S) -> &mut Self
source§fn set_logx<N: Into<f64>>(&mut self, logx: N) -> &mut Self
fn set_logx<N: Into<f64>>(&mut self, logx: N) -> &mut Self
source§fn set_logy<N: Into<f64>>(&mut self, logy: N) -> &mut Self
fn set_logy<N: Into<f64>>(&mut self, logy: N) -> &mut Self
source§fn set_logz<N: Into<f64>>(&mut self, logz: N) -> &mut Self
fn set_logz<N: Into<f64>>(&mut self, logz: N) -> &mut Self
source§fn set_xlog<N: Into<f64>>(&mut self, logx: N) -> &mut Self
fn set_xlog<N: Into<f64>>(&mut self, logx: N) -> &mut Self
source§fn set_ylog<N: Into<f64>>(&mut self, logy: N) -> &mut Self
fn set_ylog<N: Into<f64>>(&mut self, logy: N) -> &mut Self
source§fn set_zlog<N: Into<f64>>(&mut self, logz: N) -> &mut Self
fn set_zlog<N: Into<f64>>(&mut self, logz: N) -> &mut Self
source§fn set_labelx<S: Display>(&mut self, labelx: S) -> &mut Self
fn set_labelx<S: Display>(&mut self, labelx: S) -> &mut Self
source§fn set_labely<S: Display>(&mut self, labely: S) -> &mut Self
fn set_labely<S: Display>(&mut self, labely: S) -> &mut Self
source§fn set_labelz<S: Display>(&mut self, labelz: S) -> &mut Self
fn set_labelz<S: Display>(&mut self, labelz: S) -> &mut Self
source§fn set_xlabel<S: Display>(&mut self, labelx: S) -> &mut Self
fn set_xlabel<S: Display>(&mut self, labelx: S) -> &mut Self
source§fn set_ylabel<S: Display>(&mut self, labely: S) -> &mut Self
fn set_ylabel<S: Display>(&mut self, labely: S) -> &mut Self
source§fn set_zlabel<S: Display>(&mut self, labelz: S) -> &mut Self
fn set_zlabel<S: Display>(&mut self, labelz: S) -> &mut Self
source§fn set_rangex<S, T>(&mut self, left: S, right: T) -> &mut Self
fn set_rangex<S, T>(&mut self, left: S, right: T) -> &mut Self
source§fn set_rangey<S, T>(&mut self, down: S, up: T) -> &mut Self
fn set_rangey<S, T>(&mut self, down: S, up: T) -> &mut Self
source§fn set_rangez<S, T>(&mut self, down: S, up: T) -> &mut Self
fn set_rangez<S, T>(&mut self, down: S, up: T) -> &mut Self
source§fn set_xrange<S, T>(&mut self, left: S, right: T) -> &mut Self
fn set_xrange<S, T>(&mut self, left: S, right: T) -> &mut Self
source§fn set_yrange<S, T>(&mut self, down: S, up: T) -> &mut Self
fn set_yrange<S, T>(&mut self, down: S, up: T) -> &mut Self
source§fn set_zrange<S, T>(&mut self, down: S, up: T) -> &mut Self
fn set_zrange<S, T>(&mut self, down: S, up: T) -> &mut Self
source§fn set_data_extension<S: AsRef<OsStr>>(&mut self, extension: S) -> &mut Self
fn set_data_extension<S: AsRef<OsStr>>(&mut self, extension: S) -> &mut Self
source§fn set_plot_extension<S: AsRef<OsStr>>(&mut self, extension: S) -> &mut Self
fn set_plot_extension<S: AsRef<OsStr>>(&mut self, extension: S) -> &mut Self
source§fn set_header(&mut self, header: bool) -> &mut Self
fn set_header(&mut self, header: bool) -> &mut Self
source§fn set_style<S>(
&mut self,
style: S
) -> Result<&mut Self, <S as TryInto<Style>>::Error>
fn set_style<S>( &mut self, style: S ) -> Result<&mut Self, <S as TryInto<Style>>::Error>
Style
struct.
If you set a style and then compare with other structs, then
in the joint plot, the style shall be mantained for those structs that had
a style not setted by default. Read moresource§fn set_dashtype(&mut self, dashtype: usize) -> &mut Self
fn set_dashtype(&mut self, dashtype: usize) -> &mut Self
source§fn set_date(&mut self, date: DateTime<Local>) -> &mut Self
fn set_date(&mut self, date: DateTime<Local>) -> &mut Self
source§fn set_id<S: Display>(&mut self, id: S) -> &mut Self
fn set_id<S: Display>(&mut self, id: S) -> &mut Self
source§fn set_custom<S: Display, T: Display>(&mut self, key: S, value: T) -> &mut Self
fn set_custom<S: Display, T: Display>(&mut self, key: S, value: T) -> &mut Self
Configuration
struct.
This is intended for all new configurations you want, specially if
you are implementing the traits. Read moresource§fn set_ticsx<T, S>(&mut self, ticsx: T) -> &mut Self
fn set_ticsx<T, S>(&mut self, ticsx: T) -> &mut Self
""
shows no tics.
See gnuplot documentation for a correct format. Read moresource§fn set_ticsy<T, S>(&mut self, ticsy: T) -> &mut Self
fn set_ticsy<T, S>(&mut self, ticsy: T) -> &mut Self
""
shows no tics.
See gnuplot documentation for a correct format. Read moresource§fn set_ticsz<T, S>(&mut self, ticsz: T) -> &mut Self
fn set_ticsz<T, S>(&mut self, ticsz: T) -> &mut Self
""
shows no tics.
See gnuplot documentation for a correct format.source§fn set_xtics<T, S>(&mut self, ticsx: T) -> &mut Self
fn set_xtics<T, S>(&mut self, ticsx: T) -> &mut Self
source§fn set_ytics<T, S>(&mut self, ticsy: T) -> &mut Self
fn set_ytics<T, S>(&mut self, ticsy: T) -> &mut Self
source§fn set_ztics<T, S>(&mut self, ticsz: T) -> &mut Self
fn set_ztics<T, S>(&mut self, ticsz: T) -> &mut Self
source§fn set_pause<T, S>(&mut self, pause: T) -> &mut Self
fn set_pause<T, S>(&mut self, pause: T) -> &mut Self
0
, instead of None
. Read morefn title(&self) -> Option<&String>
fn logx(&self) -> Option<f64>
fn logy(&self) -> Option<f64>
fn logz(&self) -> Option<f64>
fn xlog(&self) -> Option<f64>
fn ylog(&self) -> Option<f64>
fn zlog(&self) -> Option<f64>
fn labelx(&self) -> Option<&String>
fn labely(&self) -> Option<&String>
fn labelz(&self) -> Option<&String>
fn xlabel(&self) -> Option<&String>
fn ylabel(&self) -> Option<&String>
fn zlabel(&self) -> Option<&String>
fn rangex(&self) -> Option<(f64, f64)>
fn rangey(&self) -> Option<(f64, f64)>
fn rangez(&self) -> Option<(f64, f64)>
fn xrange(&self) -> Option<(f64, f64)>
fn yrange(&self) -> Option<(f64, f64)>
fn zrange(&self) -> Option<(f64, f64)>
fn plot_extension(&self) -> Option<&OsStr>
fn data_extension(&self) -> Option<&OsStr>
fn plot_path(&self) -> &Path
fn data_path(&self) -> &Path
fn header(&self) -> bool
fn style(&self) -> &Style
fn dashtype(&self) -> Option<usize>
fn date(&self) -> &DateTime<Local>
fn id(&self) -> Option<&String>
fn checked_id(&self) -> &String
fn custom<S: Display>(&self, key: S) -> Option<&String>
fn ticsx(&self) -> Option<&String>
fn ticsy(&self) -> Option<&String>
fn ticsz(&self) -> Option<&String>
fn xtics(&self) -> Option<&String>
fn ytics(&self) -> Option<&String>
fn ztics(&self) -> Option<&String>
fn pause(&self) -> Option<f64>
source§impl<T> PartialEq for Density<T>
impl<T> PartialEq for Density<T>
source§impl<T> Plotable for Density<T>
impl<T> Plotable for Density<T>
source§fn plot_script(&self) -> String
fn plot_script(&self) -> String
source§fn plot_later<S: Display>(
&mut self,
id: S
) -> Result<&mut Self, PreexplorerError>
fn plot_later<S: Display>( &mut self, id: S ) -> Result<&mut Self, PreexplorerError>
source§fn plot<S: Display>(&mut self, id: S) -> Result<&mut Self, PreexplorerError>
fn plot<S: Display>(&mut self, id: S) -> Result<&mut Self, PreexplorerError>
source§fn plot_with_script<S: Display, T: Display>(
&mut self,
id: S,
script: T
) -> Result<&mut Self, PreexplorerError>
fn plot_with_script<S: Display, T: Display>( &mut self, id: S, script: T ) -> Result<&mut Self, PreexplorerError>
source§fn write_plot_script<S: Display>(
&self,
gnuplot_script: S
) -> Result<&Self, PreexplorerError>
fn write_plot_script<S: Display>( &self, gnuplot_script: S ) -> Result<&Self, PreexplorerError>
plot_script
in the machine for posterior running. Read moresource§fn opening_plot_script(&self) -> String
fn opening_plot_script(&self) -> String
Plotable
.source§fn ending_plot_script(&self) -> String
fn ending_plot_script(&self) -> String
Plotable
.source§impl<T> Saveable for Density<T>
impl<T> Saveable for Density<T>
source§fn plotable_data(&self) -> String
fn plotable_data(&self) -> String
source§fn save(&self) -> Result<&Self, PreexplorerError>
fn save(&self) -> Result<&Self, PreexplorerError>
target\\preexplorer\\data\\
. Read moresource§fn save_with_id<S: Display>(&self, id: S) -> Result<&Self, PreexplorerError>
fn save_with_id<S: Display>(&self, id: S) -> Result<&Self, PreexplorerError>
id
.
It does not change the current id to save the data. Read more