Struct Linspace
pub struct Linspace<T, S, R>where
T: Ranged,
S: Clone,
R: LinspaceRoundingMethod<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Add<S, Output = <T as Ranged>::ValueType> + PartialOrd + Clone,{ /* 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§
§impl<T, S, R> Linspace<T, S, R>
impl<T, S, R> Linspace<T, S, R>
pub fn use_ceil(self) -> Linspace<T, S, Ceil<<T as Ranged>::ValueType>>
pub fn use_ceil(self) -> Linspace<T, S, Ceil<<T as Ranged>::ValueType>>
Set the linspace use the round up method for value matching
- returns: The newly created linspace that uses new matching method
pub fn use_floor(self) -> Linspace<T, S, Floor<<T as Ranged>::ValueType>>
pub fn use_floor(self) -> Linspace<T, S, Floor<<T as Ranged>::ValueType>>
Set the linspace use the round down method for value matching
- returns: The newly created linspace that uses new matching method
Trait Implementations§
§impl<T, S, R> DiscreteRanged for Linspace<T, S, R>
impl<T, S, R> DiscreteRanged for Linspace<T, S, R>
§fn size(&self) -> usize
fn size(&self) -> usize
§fn index_of(&self, value: &<T as Ranged>::ValueType) -> Option<usize>
fn index_of(&self, value: &<T as Ranged>::ValueType) -> Option<usize>
§fn from_index(&self, idx: usize) -> Option<<T as Ranged>::ValueType>
fn from_index(&self, idx: usize) -> Option<<T as Ranged>::ValueType>
§fn values(&self) -> DiscreteValueIter<'_, Self>where
Self: Sized,
fn values(&self) -> DiscreteValueIter<'_, Self>where
Self: Sized,
§impl<T, S, R> Ranged for Linspace<T, S, R>
impl<T, S, R> Ranged for Linspace<T, S, R>
§type FormatOption = NoDefaultFormatting
type FormatOption = NoDefaultFormatting
§fn map(&self, value: &<T as Ranged>::ValueType, limit: (i32, i32)) -> i32
fn map(&self, value: &<T as Ranged>::ValueType, limit: (i32, i32)) -> i32
§fn key_points<Hint>(&self, hint: Hint) -> Vec<<T as Ranged>::ValueType>where
Hint: KeyPointHint,
fn key_points<Hint>(&self, hint: Hint) -> Vec<<T as Ranged>::ValueType>where
Hint: KeyPointHint,
§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§
§impl<T> AsRangedCoord for Twhere
T: Ranged,
impl<T> AsRangedCoord for Twhere
T: Ranged,
§impl<T> BindKeyPointMethod for Twhere
T: AsRangedCoord,
impl<T> BindKeyPointMethod for Twhere
T: AsRangedCoord,
§fn with_key_point_func<F>(
self,
func: F,
) -> WithKeyPointMethod<Self::CoordDescType>
fn with_key_point_func<F>( self, func: F, ) -> WithKeyPointMethod<Self::CoordDescType>
§impl<T> BindKeyPoints for Twhere
T: AsRangedCoord,
impl<T> BindKeyPoints for Twhere
T: AsRangedCoord,
§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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more