pub struct SequenceBin<T>
where T: Display + Clone,
{ /* private fields */ }
Expand description

Sequence of histograms normalize to represent a probability density function through bins.

To renormalize the histograms (that cover a unit area by default), change the renormalization constant in the gnuplot script.
By trying out with gnuplot, you can find the perfect fit.

§Examples

Quick plot.

use preexplorer::prelude::*;
let data = (0..10).map(|i| (i..10 + i));
let binwidth = 0.5;
pre::SequenceBin::new(data, binwidth).plot("my_identifier").unwrap();

Compare SequenceBin structs.

use preexplorer::prelude::*;
pre::SequenceBins::new(vec![
    pre::SequenceBin::new((0..10).map(|i| (i..10 + i)), 1),
    pre::SequenceBin::new((0..10).map(|i| (i..10 + i)), 0.5),
    ])
    .plot("my_identifier").unwrap();

Implementations§

source§

impl<T> SequenceBin<T>
where T: Display + Clone,

source

pub fn new<I, J, S>(data: I, binwidth: S) -> SequenceBin<T>
where I: IntoIterator<Item = J>, J: IntoIterator<Item = T>, S: Into<f64>,

Constructs a new SequenceBin<T>.

§Remarks

To change the binwidth, please refer to the gnuplot script generated. By construction, a fixed binwidth is needed. This is okay in most of the cases, since it gives consistency and allows plotting constant values. If you want to change it, please go to the gnuplot script.

Negative binwidths are handled by gnuplot. This crate simply prints the binwidth in the correct place in the gnuplot script generated, so if you use a value less or equal to zero gnuplot will resolve this issue by using a default behaviour.

§Examples

From a complicated computation.

use preexplorer::prelude::*;
let data = (0..10).map(|i| (i..10 + i));
let binwidth = 0.5;
let seq_bin = pre::SequenceBin::new(data, binwidth);

Trait Implementations§

source§

impl<T> Add<SequenceBin<T>> for SequenceBins<T>
where T: Display + Clone,

§

type Output = SequenceBins<T>

The resulting type after applying the + operator.
source§

fn add(self, other: SequenceBin<T>) -> Self

Performs the + operation. Read more
source§

impl<T> Add for SequenceBin<T>
where T: Display + Clone,

§

type Output = SequenceBins<T>

The resulting type after applying the + operator.
source§

fn add(self, other: SequenceBin<T>) -> SequenceBins<T>

Performs the + operation. Read more
source§

impl<T> AddAssign<SequenceBin<T>> for SequenceBins<T>
where T: Display + Clone,

source§

fn add_assign(&mut self, other: SequenceBin<T>)

Performs the += operation. Read more
source§

impl<T> Clone for SequenceBin<T>
where T: Display + Clone + Clone,

source§

fn clone(&self) -> SequenceBin<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Configurable for SequenceBin<T>
where T: Display + Clone,

source§

fn configuration_mut(&mut self) -> &mut Configuration

Mutable access to Configuration.
source§

fn configuration(&self) -> &Configuration

Reference access to Configuration.
source§

fn set_title<S: Display>(&mut self, title: S) -> &mut Self

Set title, which in comparisons correspond to legends.
source§

fn set_logx<N: Into<f64>>(&mut self, logx: N) -> &mut Self

Set logaritmic scale in the x axis. Read more
source§

fn set_logy<N: Into<f64>>(&mut self, logy: N) -> &mut Self

Set logaritmic scale in the y axis. Read more
source§

fn set_logz<N: Into<f64>>(&mut self, logz: N) -> &mut Self

Set logaritmic scale in the z axis. Read more
source§

fn set_xlog<N: Into<f64>>(&mut self, logx: N) -> &mut Self

Set logaritmic scale in the x axis. Read more
source§

fn set_ylog<N: Into<f64>>(&mut self, logy: N) -> &mut Self

Set logaritmic scale in the y axis. Read more
source§

fn set_zlog<N: Into<f64>>(&mut self, logz: N) -> &mut Self

Set logaritmic scale in the z axis. Read more
source§

fn set_labelx<S: Display>(&mut self, labelx: S) -> &mut Self

Set a label in the x axis.
source§

fn set_labely<S: Display>(&mut self, labely: S) -> &mut Self

Set a label in the y axis.
source§

fn set_labelz<S: Display>(&mut self, labelz: S) -> &mut Self

Set a label in the z axis.
source§

fn set_xlabel<S: Display>(&mut self, labelx: S) -> &mut Self

Set a label in the x axis. Read more
source§

fn set_ylabel<S: Display>(&mut self, labely: S) -> &mut Self

Set a label in the y axis. Read more
source§

fn set_zlabel<S: Display>(&mut self, labelz: S) -> &mut Self

Set a label in the z axis. Read more
source§

fn set_rangex<S, T>(&mut self, left: S, right: T) -> &mut Self
where f64: From<S> + From<T>,

Set the range in the x axis. If left > right, then the x axis is inverted.
source§

fn set_rangey<S, T>(&mut self, down: S, up: T) -> &mut Self
where f64: From<S> + From<T>,

Set the range in the y axis. If down > up, then the y axis is inverted.
source§

fn set_rangez<S, T>(&mut self, down: S, up: T) -> &mut Self
where f64: From<S> + From<T>,

Set the range in the z axis. If down > up, then the z axis is inverted.
source§

fn set_xrange<S, T>(&mut self, left: S, right: T) -> &mut Self
where f64: From<S> + From<T>,

Set the range in the x axis. If left > right, then the x axis is inverted. Read more
source§

fn set_yrange<S, T>(&mut self, down: S, up: T) -> &mut Self
where f64: From<S> + From<T>,

Set the range in the y axis. If down > up, then the y axis is inverted. Read more
source§

fn set_zrange<S, T>(&mut self, down: S, up: T) -> &mut Self
where f64: From<S> + From<T>,

Set the range in the z axis. If down > up, then the y axis is inverted. Read more
source§

fn set_data_extension<S: AsRef<OsStr>>(&mut self, extension: S) -> &mut Self

Set an extension for the data file. Read more
source§

fn set_plot_extension<S: AsRef<OsStr>>(&mut self, extension: S) -> &mut Self

Set an extension for the data file. Read more
source§

fn set_header(&mut self, header: bool) -> &mut Self

Decide the presence of headers in the data file. If activated, then title, date and other information are included as a comment in the data file. Read more
source§

fn set_style<S>( &mut self, style: S ) -> Result<&mut Self, <S as TryInto<Style>>::Error>
where S: TryInto<Style>,

Choose the style for the plot. Too see all options, go to 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 more
source§

fn set_dashtype(&mut self, dashtype: usize) -> &mut Self

Choose the dashtype for the plot. Following the gnuplot standar, it has a cyclic behaviour.
source§

fn set_date(&mut self, date: DateTime<Local>) -> &mut Self

Choose the date used when saving files. Read more
source§

fn set_id<S: Display>(&mut self, id: S) -> &mut Self

Set the unique id or file name with which both data and plot script will be saved. There is no default value and one must set it before plotting or saving. Read more
source§

fn set_custom<S: Display, T: Display>(&mut self, key: S, value: T) -> &mut Self

Include custom configuration fields into the Configuration struct. This is intended for all new configurations you want, specially if you are implementing the traits. Read more
source§

fn set_ticsx<T, S>(&mut self, ticsx: T) -> &mut Self
where T: Into<Option<S>>, S: Display,

Control tics in the x axis. Passing "" shows no tics. See gnuplot documentation for a correct format. Read more
source§

fn set_ticsy<T, S>(&mut self, ticsy: T) -> &mut Self
where T: Into<Option<S>>, S: Display,

Control tics in the y axis. Passing "" shows no tics. See gnuplot documentation for a correct format. Read more
source§

fn set_ticsz<T, S>(&mut self, ticsz: T) -> &mut Self
where T: Into<Option<S>>, S: Display,

Control tics in the z axis. Passing "" shows no tics. See gnuplot documentation for a correct format.
source§

fn set_xtics<T, S>(&mut self, ticsx: T) -> &mut Self
where T: Into<Option<S>>, S: Display,

Control tics in the x axis. See gnuplot documentation for a correct format. Read more
source§

fn set_ytics<T, S>(&mut self, ticsy: T) -> &mut Self
where T: Into<Option<S>>, S: Display,

Control tics in the y axis. See gnuplot documentation for a correct format. Read more
source§

fn set_ztics<T, S>(&mut self, ticsz: T) -> &mut Self
where T: Into<Option<S>>, S: Display,

Control tics in the z axis. See gnuplot documentation for a correct format. Read more
source§

fn set_pause<T, S>(&mut self, pause: T) -> &mut Self
where T: Into<Option<S>>, f64: From<S>,

Control the time for which the plot is in the screen. The unit is seconds. Any negative number means “until a key is pressed”. To have no pause, pass 0, instead of None. Read more
source§

fn title(&self) -> Option<&String>

source§

fn logx(&self) -> Option<f64>

source§

fn logy(&self) -> Option<f64>

source§

fn logz(&self) -> Option<f64>

source§

fn xlog(&self) -> Option<f64>

source§

fn ylog(&self) -> Option<f64>

source§

fn zlog(&self) -> Option<f64>

source§

fn labelx(&self) -> Option<&String>

source§

fn labely(&self) -> Option<&String>

source§

fn labelz(&self) -> Option<&String>

source§

fn xlabel(&self) -> Option<&String>

source§

fn ylabel(&self) -> Option<&String>

source§

fn zlabel(&self) -> Option<&String>

source§

fn rangex(&self) -> Option<(f64, f64)>

source§

fn rangey(&self) -> Option<(f64, f64)>

source§

fn rangez(&self) -> Option<(f64, f64)>

source§

fn xrange(&self) -> Option<(f64, f64)>

source§

fn yrange(&self) -> Option<(f64, f64)>

source§

fn zrange(&self) -> Option<(f64, f64)>

source§

fn plot_extension(&self) -> Option<&OsStr>

source§

fn data_extension(&self) -> Option<&OsStr>

source§

fn plot_path(&self) -> &Path

source§

fn data_path(&self) -> &Path

source§

fn header(&self) -> bool

source§

fn style(&self) -> &Style

source§

fn dashtype(&self) -> Option<usize>

source§

fn date(&self) -> &DateTime<Local>

source§

fn id(&self) -> Option<&String>

source§

fn checked_id(&self) -> &String

source§

fn custom<S: Display>(&self, key: S) -> Option<&String>

source§

fn ticsx(&self) -> Option<&String>

source§

fn ticsy(&self) -> Option<&String>

source§

fn ticsz(&self) -> Option<&String>

source§

fn xtics(&self) -> Option<&String>

source§

fn ytics(&self) -> Option<&String>

source§

fn ztics(&self) -> Option<&String>

source§

fn pause(&self) -> Option<f64>

source§

impl<T> Debug for SequenceBin<T>
where T: Display + Clone + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> From<SequenceBin<T>> for SequenceBins<T>
where T: Display + Clone,

source§

fn from(sequence: SequenceBin<T>) -> Self

Converts to this type from the input type.
source§

impl<T> PartialEq for SequenceBin<T>
where T: Display + Clone + PartialEq,

source§

fn eq(&self, other: &SequenceBin<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Plotable for SequenceBin<T>
where T: Display + Clone,

source§

fn plot_script(&self) -> String

Construct a suitable plot script for the struct.
source§

fn plot_later<S: Display>( &mut self, id: S ) -> Result<&mut Self, PreexplorerError>

Do everything except running the command of plotting. In other words: Read more
source§

fn plot<S: Display>(&mut self, id: S) -> Result<&mut Self, PreexplorerError>

Main command. In other words: Read more
source§

fn plot_with_script<S: Display, T: Display>( &mut self, id: S, script: T ) -> Result<&mut Self, PreexplorerError>

Plot with a custom script. In other words: Read more
source§

fn write_plot_script<S: Display>( &self, gnuplot_script: S ) -> Result<&Self, PreexplorerError>

Write plot script given by plot_script in the machine for posterior running. Read more
source§

fn opening_plot_script(&self) -> String

Helper method for implementing Plotable.
source§

fn ending_plot_script(&self) -> String

Helper method for implementing Plotable.
source§

impl<T> Saveable for SequenceBin<T>
where T: Display + Clone,

source§

fn plotable_data(&self) -> String

Extract the data from the struct. Read more
source§

fn save(&self) -> Result<&Self, PreexplorerError>

Save the data in a file. The directory is target\\preexplorer\\data\\. Read more
source§

fn save_with_id<S: Display>(&self, id: S) -> Result<&Self, PreexplorerError>

Save the file with a given id. It does not change the current id to save the data. Read more
source§

impl<T> StructuralPartialEq for SequenceBin<T>
where T: Display + Clone,

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for SequenceBin<T>
where T: RefUnwindSafe,

§

impl<T> Send for SequenceBin<T>
where T: Send,

§

impl<T> Sync for SequenceBin<T>
where T: Sync,

§

impl<T> Unpin for SequenceBin<T>
where T: Unpin,

§

impl<T> UnwindSafe for SequenceBin<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src
where Scheme: ApproxScheme,

§

type Err = NoError

The error type produced by a failed conversion.
source§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
source§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src
where Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
source§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, Dst> ConvAsUtil<Dst> for T

source§

fn approx(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject with the default scheme.
source§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
source§

impl<T> ConvUtil for T

source§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject to a given type with the default scheme.
source§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
source§

fn into_as<Dst>(self) -> Dst
where Self: Sized + Into<Dst>,

Convert the subject to a given type.
source§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
source§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<Src> TryFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
source§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<Src, Dst> TryInto<Dst> for Src
where Dst: TryFrom<Src>,

§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
source§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<Src> ValueFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
source§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
source§

impl<Src, Dst> ValueInto<Dst> for Src
where Dst: ValueFrom<Src>,

§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
source§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.