pub struct SecAxis {
pub transform: fn(f64) -> f64,
pub name: String,
pub breaks: Option<Vec<f64>>,
}Expand description
A secondary axis specification — defines a transformation from the primary axis domain.
§Example
use ggplot_rs::prelude::*;
// Temperature in Celsius on primary, Fahrenheit on secondary
let sec = SecAxis::new(|c| c * 9.0 / 5.0 + 32.0).with_name("Fahrenheit");Fields§
§transform: fn(f64) -> f64Transformation from primary axis values to secondary axis values.
name: StringName / title for the secondary axis.
breaks: Option<Vec<f64>>Custom break positions in primary axis coordinates.
Implementations§
Source§impl SecAxis
impl SecAxis
Sourcepub fn new(transform: fn(f64) -> f64) -> Self
pub fn new(transform: fn(f64) -> f64) -> Self
Create a secondary axis with the given transformation function.
pub fn with_name(self, name: &str) -> Self
pub fn with_breaks(self, breaks: Vec<f64>) -> Self
Sourcepub fn transform_value(&self, v: f64) -> f64
pub fn transform_value(&self, v: f64) -> f64
Transform a primary axis value to the secondary axis value.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SecAxis
impl RefUnwindSafe for SecAxis
impl Send for SecAxis
impl Sync for SecAxis
impl Unpin for SecAxis
impl UnsafeUnpin for SecAxis
impl UnwindSafe for SecAxis
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