pub struct ContinuousColorScale { /* private fields */ }Expand description
One complete continuous kind, optional gradient and optional exact domain.
use lichtung_plot::{
scales::{ColorDomain, ColorStop, ContinuousColorScale, DivergingGradient},
style::OpaqueColor,
};
let gradient = DivergingGradient::new([
ColorStop::new(0.0, OpaqueColor::hex("#204080")?)?,
ColorStop::new(0.5, OpaqueColor::hex("#EEEEEE")?)?,
ColorStop::new(1.0, OpaqueColor::hex("#A04020")?)?,
])?;
let scale = ContinuousColorScale::diverging(
0.0, Some(gradient), Some(ColorDomain::exact(-1.0, 3.0)?),
)?;
assert_eq!(scale.get_center(), Some(0.0));The replaced Heatmap-only selector is removed:
use lichtung_plot::HeatmapScale;Implementations§
Source§impl ContinuousColorScale
impl ContinuousColorScale
Sourcepub fn sequential(
gradient: Option<SequentialGradient>,
domain: Option<ColorDomain>,
) -> Result<Self>
pub fn sequential( gradient: Option<SequentialGradient>, domain: Option<ColorDomain>, ) -> Result<Self>
Select sequential mapping; None gradient/domain means owner default/automatic domain.
Sourcepub fn diverging(
center: f64,
gradient: Option<DivergingGradient>,
domain: Option<ColorDomain>,
) -> Result<Self>
pub fn diverging( center: f64, gradient: Option<DivergingGradient>, domain: Option<ColorDomain>, ) -> Result<Self>
Select a finite center and optional complete gradient/domain containing that center.
Sourcepub fn kind(&self) -> ContinuousScaleKind
pub fn kind(&self) -> ContinuousScaleKind
Inspect the closed mapping kind.
Sourcepub fn get_center(&self) -> Option<f64>
pub fn get_center(&self) -> Option<f64>
Inspect the exact diverging center, or None for sequential mapping.
Sourcepub fn get_domain(&self) -> Option<&ColorDomain>
pub fn get_domain(&self) -> Option<&ColorDomain>
Borrow the optional exact domain; None means automatic from active finite values.
Sourcepub fn get_sequential_gradient(&self) -> Option<&SequentialGradient>
pub fn get_sequential_gradient(&self) -> Option<&SequentialGradient>
Borrow a supplied sequential gradient, if this is its selected kind.
Sourcepub fn get_diverging_gradient(&self) -> Option<&DivergingGradient>
pub fn get_diverging_gradient(&self) -> Option<&DivergingGradient>
Borrow a supplied diverging gradient, if this is its selected kind.
Sourcepub fn domain(self, domain: Option<ColorDomain>) -> Result<Self>
pub fn domain(self, domain: Option<ColorDomain>) -> Result<Self>
Replace the optional exact domain, preserving kind and any center containment.
Sourcepub fn center(self, value: f64) -> Result<Self>
pub fn center(self, value: f64) -> Result<Self>
Replace a diverging center; reject sequential kind or an excluding exact domain.
Sourcepub fn sequential_gradient(
self,
value: Option<SequentialGradient>,
) -> Result<Self>
pub fn sequential_gradient( self, value: Option<SequentialGradient>, ) -> Result<Self>
Replace the optional sequential gradient; reject a diverging selection.
Sourcepub fn diverging_gradient(
self,
value: Option<DivergingGradient>,
) -> Result<Self>
pub fn diverging_gradient( self, value: Option<DivergingGradient>, ) -> Result<Self>
Replace the optional diverging gradient; reject a sequential selection.
Trait Implementations§
Source§impl Clone for ContinuousColorScale
impl Clone for ContinuousColorScale
Source§impl Debug for ContinuousColorScale
impl Debug for ContinuousColorScale
impl Eq for ContinuousColorScale
Source§impl PartialEq for ContinuousColorScale
impl PartialEq for ContinuousColorScale
impl StructuralPartialEq for ContinuousColorScale
Auto Trait Implementations§
impl Forget for ContinuousColorScale
impl Freeze for ContinuousColorScale
impl Move for ContinuousColorScale
impl RefUnwindSafe for ContinuousColorScale
impl Send for ContinuousColorScale
impl Sync for ContinuousColorScale
impl Unpin for ContinuousColorScale
impl UnsafeUnpin for ContinuousColorScalewhere
*const ArcInner<Vec<ColorStop>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Vec<ColorStop>>>: UnsafeUnpin,
impl UnwindSafe for ContinuousColorScale
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.