pub enum ContourStylePolicy<'a> {
Uniform(ShapeStyle),
Ordered(Vec<ShapeStyle>),
ByLevel(Box<dyn Fn(f64) -> ShapeStyle + 'a>),
Continuous {
minimum: f64,
maximum: f64,
stroke_width: u32,
map: Box<dyn Fn(f64) -> RGBAColor + 'a>,
},
}Expand description
Maps contour levels to Plotters-native line styles.
Variants§
Uniform(ShapeStyle)
Use one style for every contour level.
Ordered(Vec<ShapeStyle>)
Apply styles in level order, cycling when there are more levels than styles.
ByLevel(Box<dyn Fn(f64) -> ShapeStyle + 'a>)
Select a style directly from the scalar level value.
Continuous
Map the normalized level range to an RGBA colour and fixed stroke width.
Implementations§
Source§impl<'a> ContourStylePolicy<'a>
impl<'a> ContourStylePolicy<'a>
Sourcepub fn uniform<S: Into<ShapeStyle>>(style: S) -> Self
pub fn uniform<S: Into<ShapeStyle>>(style: S) -> Self
Construct a uniform style policy.
Sourcepub fn ordered<I, S>(styles: I) -> Result<Self, SeriesError>
pub fn ordered<I, S>(styles: I) -> Result<Self, SeriesError>
Construct a cycling ordered palette.
Sourcepub fn continuous<F>(
minimum: f64,
maximum: f64,
stroke_width: u32,
map: F,
) -> Result<Self, SeriesError>
pub fn continuous<F>( minimum: f64, maximum: f64, stroke_width: u32, map: F, ) -> Result<Self, SeriesError>
Construct a continuous colour-map policy.
The callback receives a normalized value in [0, 1].
Sourcepub fn style_for(
&self,
index: usize,
level: f64,
) -> Result<ShapeStyle, SeriesError>
pub fn style_for( &self, index: usize, level: f64, ) -> Result<ShapeStyle, SeriesError>
Resolve the style for one level index and value.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ContourStylePolicy<'a>
impl<'a> !Send for ContourStylePolicy<'a>
impl<'a> !Sync for ContourStylePolicy<'a>
impl<'a> !UnwindSafe for ContourStylePolicy<'a>
impl<'a> Freeze for ContourStylePolicy<'a>
impl<'a> Unpin for ContourStylePolicy<'a>
impl<'a> UnsafeUnpin for ContourStylePolicy<'a>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more