Skip to main content

ggplot_rs/stat/
mod.rs

1pub mod bin;
2pub mod bin2d;
3pub mod bindot;
4pub mod binhex;
5pub mod boxplot;
6pub mod contour;
7pub mod contour_filled;
8pub mod count;
9pub mod density;
10pub mod density2d;
11pub mod ecdf;
12pub mod ellipse;
13pub mod function;
14pub mod identity;
15pub mod loess;
16pub mod marching_squares;
17pub mod qq;
18#[cfg(feature = "regression")]
19pub mod quantile;
20pub mod smooth;
21pub mod sum;
22pub mod summary;
23pub mod summary2d;
24pub mod summary_bin;
25pub mod ydensity;
26
27use crate::aes::{Aes, Aesthetic};
28use crate::data::DataFrame;
29use crate::scale::ScaleSet;
30
31/// Trait for statistical transformations.
32pub trait Stat: Send + Sync {
33    /// Transform data for a single group.
34    fn compute_group(&self, data: &DataFrame, scales: &ScaleSet) -> DataFrame;
35
36    /// Required aesthetics this stat needs.
37    fn required_aes(&self) -> Vec<Aesthetic>;
38
39    /// Default aesthetic mappings this stat produces.
40    fn default_aes(&self) -> Aes {
41        Aes::default()
42    }
43
44    /// Name for debug/display.
45    fn name(&self) -> &str;
46}