Skip to main content

ContourStylePolicy

Enum ContourStylePolicy 

Source
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.

Fields

§minimum: f64
§maximum: f64
§stroke_width: u32
§map: Box<dyn Fn(f64) -> RGBAColor + 'a>

Implementations§

Source§

impl<'a> ContourStylePolicy<'a>

Source

pub fn uniform<S: Into<ShapeStyle>>(style: S) -> Self

Construct a uniform style policy.

Source

pub fn ordered<I, S>(styles: I) -> Result<Self, SeriesError>
where I: IntoIterator<Item = S>, S: Into<ShapeStyle>,

Construct a cycling ordered palette.

Source

pub fn by_level<F>(provider: F) -> Self
where F: Fn(f64) -> ShapeStyle + 'a,

Construct a callback-driven style policy.

Source

pub fn continuous<F>( minimum: f64, maximum: f64, stroke_width: u32, map: F, ) -> Result<Self, SeriesError>
where F: Fn(f64) -> RGBAColor + 'a,

Construct a continuous colour-map policy.

The callback receives a normalized value in [0, 1].

Source

pub fn style_for( &self, index: usize, level: f64, ) -> Result<ShapeStyle, SeriesError>

Resolve the style for one level index and value.

Trait Implementations§

Source§

impl Default for ContourStylePolicy<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.