pub struct CoordTrans { /* private fields */ }Expand description
Transformed Cartesian coordinates (R’s coord_trans).
Unlike a scale transform (which transforms data before stats), this warps
the coordinate space at draw time — stats are computed on the raw data
but drawn on a non-linear axis. Data points, gridlines, and ticks all pass
through transform, so they warp consistently and the tick labels keep their
original (untransformed) values.
The trained data domain is supplied via Coord::set_domains during build,
so the warp is faithful. If a transform is invalid over the domain (e.g.
log10 with a non-positive minimum) the axis falls back to linear.
Implementations§
Source§impl CoordTrans
impl CoordTrans
pub fn new(x: Option<ScaleTransform>, y: Option<ScaleTransform>) -> Self
Trait Implementations§
Source§impl Coord for CoordTrans
impl Coord for CoordTrans
Source§fn transform(&self, point: (f64, f64), plot_area: &Rect) -> (f64, f64)
fn transform(&self, point: (f64, f64), plot_area: &Rect) -> (f64, f64)
Transform normalized (0..1, 0..1) coordinates to pixel coordinates.
Source§fn set_domains(&mut self, x: Option<AxisSpan>, y: Option<AxisSpan>)
fn set_domains(&mut self, x: Option<AxisSpan>, y: Option<AxisSpan>)
Supply the trained x/y axis spans after scale training. Coordinate systems
that warp the axis (e.g.
coord_trans) need this to map a normalized
position back to a data value. Default is a no-op.Source§fn is_flipped(&self) -> bool
fn is_flipped(&self) -> bool
Whether this coordinate system flips X and Y.
Source§fn is_polar(&self) -> bool
fn is_polar(&self) -> bool
Whether this is a non-linear polar system (bars become radial sectors,
so geoms that draw rectangles must tessellate their edges into an arc).
Auto Trait Implementations§
impl Freeze for CoordTrans
impl RefUnwindSafe for CoordTrans
impl Send for CoordTrans
impl Sync for CoordTrans
impl Unpin for CoordTrans
impl UnsafeUnpin for CoordTrans
impl UnwindSafe for CoordTrans
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> 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