pub trait Stat: Send + Sync {
// Required methods
fn compute_group(&self, data: &DataFrame, scales: &ScaleSet) -> DataFrame;
fn required_aes(&self) -> Vec<Aesthetic>;
fn name(&self) -> &str;
// Provided methods
fn default_aes(&self) -> Aes { ... }
fn panelwise(&self) -> bool { ... }
fn validate(&self, _warnings: &mut Vec<String>) { ... }
}Expand description
Trait for statistical transformations.
Required Methods§
Sourcefn compute_group(&self, data: &DataFrame, scales: &ScaleSet) -> DataFrame
fn compute_group(&self, data: &DataFrame, scales: &ScaleSet) -> DataFrame
Transform data for a single group.
Sourcefn required_aes(&self) -> Vec<Aesthetic>
fn required_aes(&self) -> Vec<Aesthetic>
Required aesthetics this stat needs.
Provided Methods§
Sourcefn default_aes(&self) -> Aes
fn default_aes(&self) -> Aes
Default aesthetic mappings this stat produces.
Sourcefn panelwise(&self) -> bool
fn panelwise(&self) -> bool
If true, the stat receives every row of a panel at once (grouped only by
facet variables) instead of once per aesthetic group. Needed for
cross-group comparisons such as stat_compare_means, which must see all
groups together. Defaults to per-group behaviour.
Sourcefn validate(&self, _warnings: &mut Vec<String>)
fn validate(&self, _warnings: &mut Vec<String>)
Validate the stat’s own fixed configuration (not the data) and push
a human-readable warning for each problem found — e.g.
StatBinHex::binwidth being NaN, zero or negative. Called once per
layer, before compute_group runs (which has
no warnings channel of its own: the per-group call only sees
&DataFrame and &ScaleSet, not the plot’s warnings sink). Default:
no-op.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".