Struct net_ensembles::sampling::CubeHelixParameter
source · [−]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
sourceimpl CubeHelixParameter
impl CubeHelixParameter
sourcepub fn start_color(&mut self, s: f32) -> &mut CubeHelixParameter
pub fn start_color(&mut self, s: f32) -> &mut CubeHelixParameter
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 CubeHelixParameter
pub fn gamma(&mut self, gamma: f32) -> &mut CubeHelixParameter
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 CubeHelixParameter
pub fn reverse(&mut self, reverse: bool) -> &mut CubeHelixParameter
Builder pattern - set reverse
reverse: Reverse the cbrange?
sourcepub fn low_high(&mut self, low: f32, high: f32) -> &mut CubeHelixParameter
pub fn low_high(&mut self, low: f32, high: f32) -> &mut CubeHelixParameter
Builder pattern - set low and high value
default: low = 0.0, high = 1.0
Maps grayscale range from [0.0, 1.0] -> [low, high]. These are the brightness values used for calculating the palette later on.
Safety
will panic if
low
>=high
low
< 0low
>= 1high
<= 0high
> 1
sourcepub fn hue(&mut self, hue: f32) -> &mut CubeHelixParameter
pub fn hue(&mut self, hue: f32) -> &mut CubeHelixParameter
#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 CubeHelixParameter
pub fn rotation(&mut self, rotation: f32) -> &mut CubeHelixParameter
#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
sourceimpl Clone for CubeHelixParameter
impl Clone for CubeHelixParameter
sourcefn clone(&self) -> CubeHelixParameter
fn clone(&self) -> CubeHelixParameter
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more