pub struct Linspace<T: Ranged, S: Clone, R: LinspaceRoundingMethod<T::ValueType>>{ /* private fields */ }
Expand description
The coordinate combinator that transform a continuous coordinate to a discrete coordinate to a discrete coordinate by a giving step.
For example, range 0f32..100f32
is a continuous coordinate, thus this prevent us having a
histogram on it since Plotters doesn’t know how to segment the range into buckets.
In this case, to get a histogram, we need to split the original range to a
set of discrete buckets (for example, 0.5 per bucket).
The linspace decorate abstracting this method. For example, we can have a discrete coordinate:
(0f32..100f32).step(0.5)
.
Linspace also supports different types of bucket matching method - This configuration alters the behavior of DiscreteCoord::index_of for Linspace coord spec
- Flooring, the value falls into the nearst bucket smaller than it. See Linspace::use_floor
- Round, the value falls into the nearst bucket. See Linearspace::use_round
- Ceiling, the value falls into the nearst bucket larger than itself. See Linspace::use_ceil
- Exact Matchting, the value must be exactly same as the butcket value. See Linspace::use_exact
Implementations§
Source§impl<T: Ranged, S: Clone, R: LinspaceRoundingMethod<T::ValueType>> Linspace<T, S, R>
impl<T: Ranged, S: Clone, R: LinspaceRoundingMethod<T::ValueType>> Linspace<T, S, R>
Sourcepub fn use_ceil(self) -> Linspace<T, S, Ceil<T::ValueType>>
pub fn use_ceil(self) -> Linspace<T, S, Ceil<T::ValueType>>
Set the linspace use the round up method for value matching
- returns: The newly created linspace that uses new matching method
Sourcepub fn use_floor(self) -> Linspace<T, S, Floor<T::ValueType>>
pub fn use_floor(self) -> Linspace<T, S, Floor<T::ValueType>>
Set the linspace use the round down method for value matching
- returns: The newly created linspace that uses new matching method
Trait Implementations§
Source§impl<T: Clone + Ranged, S: Clone + Clone, R: Clone + LinspaceRoundingMethod<T::ValueType>> Clone for Linspace<T, S, R>
impl<T: Clone + Ranged, S: Clone + Clone, R: Clone + LinspaceRoundingMethod<T::ValueType>> Clone for Linspace<T, S, R>
Source§impl<T: Ranged, S: Clone, R: LinspaceRoundingMethod<T::ValueType>> DiscreteRanged for Linspace<T, S, R>
impl<T: Ranged, S: Clone, R: LinspaceRoundingMethod<T::ValueType>> DiscreteRanged for Linspace<T, S, R>
Source§fn size(&self) -> usize
fn size(&self) -> usize
Source§fn from_index(&self, idx: usize) -> Option<T::ValueType>
fn from_index(&self, idx: usize) -> Option<T::ValueType>
Source§fn values(&self) -> DiscreteValueIter<'_, Self>where
Self: Sized,
fn values(&self) -> DiscreteValueIter<'_, Self>where
Self: Sized,
Source§impl<T: Ranged, S: Clone, R: LinspaceRoundingMethod<T::ValueType>> Ranged for Linspace<T, S, R>
impl<T: Ranged, S: Clone, R: LinspaceRoundingMethod<T::ValueType>> Ranged for Linspace<T, S, R>
Source§type FormatOption = NoDefaultFormatting
type FormatOption = NoDefaultFormatting
Source§fn map(&self, value: &T::ValueType, limit: (i32, i32)) -> i32
fn map(&self, value: &T::ValueType, limit: (i32, i32)) -> i32
Source§fn key_points<Hint: KeyPointHint>(&self, hint: Hint) -> Vec<T::ValueType>
fn key_points<Hint: KeyPointHint>(&self, hint: Hint) -> Vec<T::ValueType>
Source§impl<T, R, S, RM> ValueFormatter<T> for Linspace<R, S, RM>where
R: Ranged<ValueType = T> + ValueFormatter<T>,
RM: LinspaceRoundingMethod<T>,
T: Add<S, Output = T> + PartialOrd + Clone,
S: Clone,
impl<T, R, S, RM> ValueFormatter<T> for Linspace<R, S, RM>where
R: Ranged<ValueType = T> + ValueFormatter<T>,
RM: LinspaceRoundingMethod<T>,
T: Add<S, Output = T> + PartialOrd + Clone,
S: Clone,
Auto Trait Implementations§
impl<T, S, R> Freeze for Linspace<T, S, R>
impl<T, S, R> RefUnwindSafe for Linspace<T, S, R>where
<T as Ranged>::ValueType: Sized + RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
R: RefUnwindSafe,
impl<T, S, R> Send for Linspace<T, S, R>
impl<T, S, R> Sync for Linspace<T, S, R>
impl<T, S, R> Unpin for Linspace<T, S, R>
impl<T, S, R> UnwindSafe for Linspace<T, S, R>
Blanket Implementations§
Source§impl<T> AsRangedCoord for Twhere
T: Ranged,
impl<T> AsRangedCoord for Twhere
T: Ranged,
Source§impl<T> BindKeyPointMethod for Twhere
T: AsRangedCoord,
impl<T> BindKeyPointMethod for Twhere
T: AsRangedCoord,
Source§fn with_key_point_func<F: Fn(usize) -> Vec<Self::Value> + 'static>(
self,
func: F,
) -> WithKeyPointMethod<Self::CoordDescType>
fn with_key_point_func<F: Fn(usize) -> Vec<Self::Value> + 'static>( self, func: F, ) -> WithKeyPointMethod<Self::CoordDescType>
Source§impl<T> BindKeyPoints for Twhere
T: AsRangedCoord,
impl<T> BindKeyPoints for Twhere
T: AsRangedCoord,
Source§fn with_key_points(
self,
points: Vec<Self::Value>,
) -> WithKeyPoints<Self::CoordDescType>
fn with_key_points( self, points: Vec<Self::Value>, ) -> WithKeyPoints<Self::CoordDescType>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoLinspace for Twhere
T: AsRangedCoord,
impl<T> IntoLinspace for Twhere
T: AsRangedCoord,
Source§impl<R> IntoPartialAxis for Rwhere
R: AsRangedCoord,
impl<R> IntoPartialAxis for Rwhere
R: AsRangedCoord,
Source§fn partial_axis(
self,
axis_range: Range<<Self::CoordDescType as Ranged>::ValueType>,
) -> PartialAxis<Self::CoordDescType>
fn partial_axis( self, axis_range: Range<<Self::CoordDescType as Ranged>::ValueType>, ) -> PartialAxis<Self::CoordDescType>
Source§impl<DC> ReversibleRanged for DCwhere
DC: DiscreteRanged,
impl<DC> ReversibleRanged for DCwhere
DC: DiscreteRanged,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.