pub struct ScaleSet { /* private fields */ }Expand description
Registry of all scales for a plot. Handles auto-detection and training.
Implementations§
Source§impl ScaleSet
impl ScaleSet
pub fn new() -> Self
Sourcepub fn get_mut(&mut self, aes: &Aesthetic) -> Option<&mut Box<dyn Scale>>
pub fn get_mut(&mut self, aes: &Aesthetic) -> Option<&mut Box<dyn Scale>>
Get mutable scale for a specific aesthetic.
Sourcepub fn ensure_scale(&mut self, aes: &Aesthetic, data: &DataFrame)
pub fn ensure_scale(&mut self, aes: &Aesthetic, data: &DataFrame)
Ensure a scale exists for a given aesthetic. Auto-detect type from data.
Sourcepub fn train_layer(&mut self, data: &DataFrame)
pub fn train_layer(&mut self, data: &DataFrame)
Train all scales on data from one layer.
Sourcepub fn map_value(&self, aes: &Aesthetic, value: &Value) -> f64
pub fn map_value(&self, aes: &Aesthetic, value: &Value) -> f64
Map a single value through the appropriate scale.
Sourcepub fn map_color(&self, aes: &Aesthetic, value: &Value) -> Option<(u8, u8, u8)>
pub fn map_color(&self, aes: &Aesthetic, value: &Value) -> Option<(u8, u8, u8)>
Map a value to an RGB color through the appropriate color/fill scale.
Sourcepub fn map_shape(&self, value: &Value) -> Option<PointShape>
pub fn map_shape(&self, value: &Value) -> Option<PointShape>
Map a value to a point shape through the shape scale.
Sourcepub fn map_linetype(&self, value: &Value) -> Option<Linetype>
pub fn map_linetype(&self, value: &Value) -> Option<Linetype>
Map a value to a linetype through the linetype scale.
Sourcepub fn map_size(&self, value: &Value) -> Option<f64>
pub fn map_size(&self, value: &Value) -> Option<f64>
Map a value to a point size through the size scale.
Sourcepub fn map_alpha(&self, value: &Value) -> Option<f64>
pub fn map_alpha(&self, value: &Value) -> Option<f64>
Map a value to an alpha (opacity) through the alpha scale.
Sourcepub fn set_limits(&mut self, aes: &Aesthetic, min: f64, max: f64)
pub fn set_limits(&mut self, aes: &Aesthetic, min: f64, max: f64)
Override the domain limits for a scale (used by coord_cartesian zoom).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ScaleSet
impl !UnwindSafe for ScaleSet
impl Freeze for ScaleSet
impl Send for ScaleSet
impl Sync for ScaleSet
impl Unpin for ScaleSet
impl UnsafeUnpin for ScaleSet
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
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<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>
Converts
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>
Converts
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