pub struct HeatmapF64Mean<HistX, HistY> { /* private fields */ }
Expand description

Heatmap with mean of y-axis

  • stores heatmap in row-major order: the rows of the heatmap are contiguous, and the columns are strided
  • enables you to quickly create a heatmap
  • you can create gnuplot scripts to plot the heatmap
  • for each x-axis bin, the y-axis mean is calculated

Difference to HeatmapF64

  • HeatmapF64 does not contain the averages for th y-axis, but can be transposed and also used for Y-Histograms which take types which do not implement AsPrimitive<f64>

Implementations§

source§

impl<HistX, HistY> HeatmapF64Mean<HistX, HistY>

source

pub fn heatmap(&self) -> &HeatmapF64<HistX, HistY>

Internal HeatmapF64

source§

impl<HistX, HistY> HeatmapF64Mean<HistX, HistY>
where HistX: Histogram, HistY: Histogram,

source

pub fn new(hist_x: HistX, hist_y: HistY) -> Self

Create a heatmap
  • creates new instance
  • hist_x defines the bins along the x-axis
  • hist_y defines the bins along the y-axis
source

pub fn count_inside_heatmap<X, Y, A, B>( &mut self, x_val: A, y_val: B, weight: f64 ) -> Result<(usize, usize), HeatmapError>
where HistX: HistogramVal<X>, HistY: HistogramVal<Y>, A: Borrow<X>, B: Borrow<Y>, Y: AsPrimitive<f64>,

Update Heatmap

This time, however, any value that is out of bounds will be ignored for the calculation of the mean of the y-axis, meaning also values which correspond to a valid x-bin will be ignored, if their y-value is not inside the Y Histogram. The mean respects the weight

source

pub fn count<X, Y, A, B>( &mut self, x_val: A, y_val: B, weight: f64 ) -> Result<(usize, usize), HeatmapError>
where HistX: HistogramVal<X>, HistY: HistogramVal<Y>, A: Borrow<X>, B: Borrow<Y>, Y: AsPrimitive<f64>,

Update heatmap

The difference is, that the mean of the y-axis is updated as long as y_val is finite and x_val is in bounds (because the mean is calculated for each bin in the x direction separately). The calculated average respects the weight

source

pub fn mean_slice(&self) -> &[WeightedMean]

Internal slice for mean
  • The mean is calculated from this slice
  • The mean corresponds to the bins of the x-axis
source

pub fn mean_iter(&self) -> impl Iterator<Item = f64> + '_

Iterate over the calculated mean
  • iterates over the means
  • The mean corresponds to the bins of the x-axis
  • if a bin on the x-axis has no entries, the corresponding mean will be f64::NAN
source

pub fn mean(&self) -> Vec<f64>

Get a mean vector
  • The entries are the means corresponds to the bins of the x-axis
  • if a bin on the x-axis has no entries, the corresponding mean will be f64::NAN
Note
  • If you want to iterate over the mean values, use mean_iter instead
source

pub fn gnuplot_quick<W>(&self, writer: W) -> Result<()>
where W: Write,

Create a gnuplot script to plot your heatmap
  • writer: The gnuplot script will be written to this
  • gnuplot_output_name: how shall the file, created by executing gnuplot, be called? Ending of file will be set automatically
Note
source

pub fn gnuplot<W, P, GS>( &self, writer: W, settings: GS, points: P ) -> Result<()>

Create a gnuplot script to plot your heatmap

This function writes a file, that can be plotted in the terminal via gnuplot

gnuplot gnuplot_file
Parameter:
  • writer: writer gnuplot script will be written to
  • gnuplot_output_name: how shall the file, created by executing gnuplot, be called? File suffix (ending) will be set automatically
  • settings: Here you can set the axis, choose between terminals and more. I recommend that you take a look at GnuplotSettings
  • point_color: the mean (in y-direction) will be plotted as points in the heatmap. Here you can choose the point color
Notes

The default axis are the bin indices, which, e.g, means they always begin at 0. You have to set the axis via the GnuplotSettings

Auto Trait Implementations§

§

impl<HistX, HistY> RefUnwindSafe for HeatmapF64Mean<HistX, HistY>
where HistX: RefUnwindSafe, HistY: RefUnwindSafe,

§

impl<HistX, HistY> Send for HeatmapF64Mean<HistX, HistY>
where HistX: Send, HistY: Send,

§

impl<HistX, HistY> Sync for HeatmapF64Mean<HistX, HistY>
where HistX: Sync, HistY: Sync,

§

impl<HistX, HistY> Unpin for HeatmapF64Mean<HistX, HistY>
where HistX: Unpin, HistY: Unpin,

§

impl<HistX, HistY> UnwindSafe for HeatmapF64Mean<HistX, HistY>
where HistX: UnwindSafe, HistY: 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<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
§

impl<S, T> Cast<T> for S
where T: Conv<S>,

§

fn cast(self) -> T

Cast from Self to T Read more
§

fn try_cast(self) -> Result<T, Error>

Try converting from Self to T Read more
§

impl<S, T> CastApprox<T> for S
where T: ConvApprox<S>,

§

fn try_cast_approx(self) -> Result<T, Error>

Try approximate conversion from Self to T Read more
§

fn cast_approx(self) -> T

Cast approximately from Self to T Read more
§

impl<S, T> CastFloat<T> for S
where T: ConvFloat<S>,

§

fn cast_trunc(self) -> T

Cast to integer, truncating Read more
§

fn cast_nearest(self) -> T

Cast to the nearest integer Read more
§

fn cast_floor(self) -> T

Cast the floor to an integer Read more
§

fn cast_ceil(self) -> T

Cast the ceiling to an integer Read more
§

fn try_cast_trunc(self) -> Result<T, Error>

Try converting to integer with truncation Read more
§

fn try_cast_nearest(self) -> Result<T, Error>

Try converting to the nearest integer Read more
§

fn try_cast_floor(self) -> Result<T, Error>

Try converting the floor to an integer Read more
§

fn try_cast_ceil(self) -> Result<T, Error>

Try convert the ceiling to an integer Read more
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V