[−][src]Struct plotters_unstable::prelude::Linspace
The coordinate combinator that transform a continous 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: Ranged, S: Clone, R: LinspaceRoundingMethod<T::ValueType>> Linspace<T, S, R> where
T::ValueType: Add<S, Output = T::ValueType> + PartialOrd + Clone,
[src]
T::ValueType: Add<S, Output = T::ValueType> + PartialOrd + Clone,
pub fn use_ceil(self) -> Linspace<T, S, Ceil<T::ValueType>>
[src]
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::ValueType>>
[src]
Set the linspace use the round down method for value matching
- returns: The newly created linspace that uses new matching method
pub fn use_round(self) -> Linspace<T, S, Round<T::ValueType, S>> where
T::ValueType: Sub<T::ValueType, Output = S>,
S: PartialOrd,
[src]
T::ValueType: Sub<T::ValueType, Output = S>,
S: PartialOrd,
Set the linspace use the best match method for value matching
- returns: The newly created linspace that uses new matching method
pub fn use_exact(self) -> Linspace<T, S, Exact<T::ValueType>> where
T::ValueType: Sub<T::ValueType, Output = S>,
S: PartialOrd,
[src]
T::ValueType: Sub<T::ValueType, Output = S>,
S: PartialOrd,
Set the linspace use the exact match method for value matching
- returns: The newly created linspace that uses new matching method
Trait Implementations
impl<T: Clone + Ranged, S: Clone, R: Clone + LinspaceRoundingMethod<T::ValueType>> Clone for Linspace<T, S, R> where
T::ValueType: Add<S, Output = T::ValueType> + PartialOrd + Clone,
T::ValueType: Clone,
[src]
T::ValueType: Add<S, Output = T::ValueType> + PartialOrd + Clone,
T::ValueType: Clone,
impl<T: Ranged, S: Clone, R: LinspaceRoundingMethod<T::ValueType>> DiscreteRanged for Linspace<T, S, R> where
T::ValueType: Add<S, Output = T::ValueType> + PartialOrd + Clone,
[src]
T::ValueType: Add<S, Output = T::ValueType> + PartialOrd + Clone,
fn size(&self) -> usize
[src]
fn index_of(&self, value: &T::ValueType) -> Option<usize>
[src]
fn from_index(&self, idx: usize) -> Option<T::ValueType>
[src]
fn values(&self) -> DiscreteValueIter<'_, Self> where
Self: Sized,
[src]
Self: Sized,
fn previous(&self, value: &Self::ValueType) -> Option<Self::ValueType>
[src]
fn next(&self, value: &Self::ValueType) -> Option<Self::ValueType>
[src]
impl<T: Ranged, S: Clone, R: LinspaceRoundingMethod<T::ValueType>> Ranged for Linspace<T, S, R> where
T::ValueType: Add<S, Output = T::ValueType> + PartialOrd + Clone,
[src]
T::ValueType: Add<S, Output = T::ValueType> + PartialOrd + Clone,
type FormatOption = NoDefaultFormatting
This marker decides if Plotters default ValueFormatter implementation should be used. This assicated type can be one of follow two types: - DefaultFormatting will allow Plotters automatically impl the formatter based on Debug
trait, if Debug
trait is not impl for the Self::Value
, ValueFormatter will not impl unless you impl it manually. Read more
type ValueType = T::ValueType
The type of this value in this range specification
fn range(&self) -> Range<T::ValueType>
[src]
fn map(&self, value: &T::ValueType, limit: (i32, i32)) -> i32
[src]
fn key_points<Hint: KeyPointHint>(&self, hint: Hint) -> Vec<T::ValueType>
[src]
fn axis_pixel_range(&self, limit: (i32, i32)) -> Range<i32>
[src]
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,
[src]
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> RefUnwindSafe for Linspace<T, S, R> where
R: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
<T as Ranged>::ValueType: RefUnwindSafe,
R: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
<T as Ranged>::ValueType: RefUnwindSafe,
impl<T, S, R> Send for Linspace<T, S, R> where
R: Send,
S: Send,
T: Send,
<T as Ranged>::ValueType: Send,
R: Send,
S: Send,
T: Send,
<T as Ranged>::ValueType: Send,
impl<T, S, R> Sync for Linspace<T, S, R> where
R: Sync,
S: Sync,
T: Sync,
<T as Ranged>::ValueType: Sync,
R: Sync,
S: Sync,
T: Sync,
<T as Ranged>::ValueType: Sync,
impl<T, S, R> Unpin for Linspace<T, S, R> where
R: Unpin,
S: Unpin,
T: Unpin,
<T as Ranged>::ValueType: Unpin,
R: Unpin,
S: Unpin,
T: Unpin,
<T as Ranged>::ValueType: Unpin,
impl<T, S, R> UnwindSafe for Linspace<T, S, R> where
R: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
<T as Ranged>::ValueType: UnwindSafe,
R: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
<T as Ranged>::ValueType: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsRangedCoord for T where
T: Ranged,
[src]
T: Ranged,
type CoordDescType = T
type Value = <T as Ranged>::ValueType
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<DC> ReversibleRanged for DC where
DC: DiscreteRanged,
[src]
DC: DiscreteRanged,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<R> ValueFormatter<<R as Ranged>::ValueType> for R where
R: Ranged<FormatOption = DefaultFormatting>,
<R as Ranged>::ValueType: Debug,
[src]
R: Ranged<FormatOption = DefaultFormatting>,
<R as Ranged>::ValueType: Debug,