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