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