pub struct PositionJitterDodge {
pub jitter_width: f64,
pub jitter_height: f64,
pub dodge_width: f64,
/* private fields */
}Expand description
Combined jitter and dodge position adjustment (ggplot2’s
position_jitterdodge()): useful for showing individual points within
dodged groups (e.g. over boxplots).
As in ggplot2, points are first dodged like PositionDodge
(groups in legend order, counted per x slot), then jittered by
jitter_width / (ndodge + 2) either side, where ndodge is the most
groups any x slot holds, so each group’s points stay inside its own
slot (#429). Default uses ggplot2’s jitter.width = NULL: 40 % of
the x resolution (0.4 on a discrete axis).
Fields§
§jitter_width: f64§jitter_height: f64§dodge_width: f64Implementations§
Trait Implementations§
Source§impl Default for PositionJitterDodge
impl Default for PositionJitterDodge
Source§impl Position for PositionJitterDodge
impl Position for PositionJitterDodge
Source§fn group_order(&self, data: &DataFrame) -> Option<Vec<String>>
fn group_order(&self, data: &DataFrame) -> Option<Vec<String>>
Dodge groups ranked like PositionDodge (legend order, #428), so
the points line up with dodged boxes / violins.
Source§fn compute(&self, data: &mut DataFrame, params: &PositionParams)
fn compute(&self, data: &mut DataFrame, params: &PositionParams)
Adjust positions for data.
fn name(&self) -> &str
Source§fn per_panel(&self) -> bool
fn per_panel(&self) -> bool
Whether this position must run separately per facet panel rather
than once on the pooled rows before facets are split (B3-3, D8).
Default
false. PositionStack/PositionFill override this to
true — a shared x category’s stack height must not mix rows from
different panels. PositionDodge/PositionDodge2/PositionJitter
also override this to true (sipemu/ggplot-rs#153): ggplot2
computes a dodge’s group count/offset via compute_panel (per
panel), and position_jitter’s default width/height — 40% of
resolution() — is likewise measured from each panel’s own x/y,
not the rows pooled across panels (verified against ggplot2 4.0.3
with layer_data() on faceted plots; see tests/position_panels_r.rs).Auto Trait Implementations§
impl Freeze for PositionJitterDodge
impl RefUnwindSafe for PositionJitterDodge
impl Send for PositionJitterDodge
impl Sync for PositionJitterDodge
impl Unpin for PositionJitterDodge
impl UnsafeUnpin for PositionJitterDodge
impl UnwindSafe for PositionJitterDodge
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
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