pub struct CubeHelixParameter { /* private fields */ }
Expand description
Implements color palett from https://arxiv.org/abs/1108.5083
What’s so good about this palett? It is monotonically increasing in perceived brightness. That means, it is well suited for being printed in black and white.
use sampling::heatmap::*;
let mut params = CubeHelixParameter::default();
params.rotation(1.3)
.gamma(1.1)
.start_color(0.3)
.reverse(true);
Implementations§
Source§impl CubeHelixParameter
impl CubeHelixParameter
Sourcepub fn start_color(&mut self, s: f32) -> &mut Self
pub fn start_color(&mut self, s: f32) -> &mut Self
§Builder pattern - set start color
Will panic if the following is false: 0.0 <= s <= 1.0
Sourcepub fn gamma(&mut self, gamma: f32) -> &mut Self
pub fn gamma(&mut self, gamma: f32) -> &mut Self
§Builder pattern - set gamma
|gamma| < 1 emphasises low intensity values, |gamma| > 1 high intensity ones
gamma has to be finite - will panic otherwise
Sourcepub fn reverse(&mut self, reverse: bool) -> &mut Self
pub fn reverse(&mut self, reverse: bool) -> &mut Self
§Builder pattern - set reverse
reverse: Reverse the cbrange?
Sourcepub fn hue(&mut self, hue: f32) -> &mut Self
pub fn hue(&mut self, hue: f32) -> &mut Self
#Set hue intensity. Builder pattern Valid values are 0.0 <= hue <= 1.0. Important Will panic on invalid hue values!
Sourcepub fn rotation(&mut self, rotation: f32) -> &mut Self
pub fn rotation(&mut self, rotation: f32) -> &mut Self
#Set rotation. Builder pattern Rotation in color space. The higher the value, the quicker the colors will change in the palett.
Normally the range used is -1.5 <= rotation <= 1.5. Invalid values are Nan, or ±Infinity Important Will panic on invalid rotation values!
Sourcepub fn rgb_from_gray(&self, gray: f32) -> [f32; 3]
pub fn rgb_from_gray(&self, gray: f32) -> [f32; 3]
Calculate color from gray value. Gray value should be in the interval [0.0,1.0].
Will return [red, green, blue]
, where red, green and blue are in [0.0, 1.0],
will return [0,0,0] for NAN gray value.
Sourcepub fn approximate_color_rgb(&self, gray: f32) -> ColorRGB
pub fn approximate_color_rgb(&self, gray: f32) -> ColorRGB
- Calculate color from gray value.
- Gray value should be in the interval [0.0,1.0].
- will return
ColorRgb::new(0,0,0)
for NAN gray value
will return corresponding (approximate) ColorRgb
Sourcepub fn into_gnuplot_palette(self) -> GnuplotPalette
pub fn into_gnuplot_palette(self) -> GnuplotPalette
Converts self
into the corresponding enum of GnuplotPallet
Trait Implementations§
Source§impl Clone for CubeHelixParameter
impl Clone for CubeHelixParameter
Source§fn clone(&self) -> CubeHelixParameter
fn clone(&self) -> CubeHelixParameter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CubeHelixParameter
impl Debug for CubeHelixParameter
Source§impl Default for CubeHelixParameter
impl Default for CubeHelixParameter
Source§impl<'de> Deserialize<'de> for CubeHelixParameter
impl<'de> Deserialize<'de> for CubeHelixParameter
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<CubeHelixParameter> for GnuplotPalette
impl From<CubeHelixParameter> for GnuplotPalette
Source§fn from(parameter: CubeHelixParameter) -> Self
fn from(parameter: CubeHelixParameter) -> Self
Source§impl Serialize for CubeHelixParameter
impl Serialize for CubeHelixParameter
impl Copy for CubeHelixParameter
Auto Trait Implementations§
impl Freeze for CubeHelixParameter
impl RefUnwindSafe for CubeHelixParameter
impl Send for CubeHelixParameter
impl Sync for CubeHelixParameter
impl Unpin for CubeHelixParameter
impl UnwindSafe for CubeHelixParameter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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