use super::GGPlot;
use crate::data::{DataFrame, Value};
use crate::geom::censor::{GeomCensorMarks, StatCensored};
use crate::geom::cooks::GeomCooksContour;
use crate::geom::errorbarh::GeomErrorbarh;
use crate::geom::qq::{GeomQQ, GeomQQBand, GeomQQLine};
use crate::geom::ribbon::GeomStepribbon;
use crate::geom::step::GeomStep;
use crate::stat::ecdf::{StatEcdf, StatEcdfBand};
use crate::stat::qq::{QQDistribution, StatQQBand, StatQQDist, StatQQLineDist};
impl GGPlot {
pub fn stat_qq(self, distribution: QQDistribution) -> Self {
self.add_geom(GeomQQ::default())
.stat(StatQQDist::new(distribution))
}
pub fn stat_qq_line(self, distribution: QQDistribution) -> Self {
self.add_geom(GeomQQLine::default())
.stat(StatQQLineDist::new(distribution))
}
pub fn stat_qq_band(self, band: StatQQBand) -> Self {
self.add_geom(GeomQQBand::default()).stat(band)
}
pub fn geom_qq_band(self) -> Self {
self.stat_qq_band(StatQQBand::default())
}
pub fn geom_qq_band_with(self, geom: GeomQQBand, band: StatQQBand) -> Self {
self.add_geom_with(geom).stat(band)
}
pub fn stat_cooks_contour(self, p: usize, levels: &[f64]) -> Self {
self.geom_cooks_contour_with(GeomCooksContour::new(p, levels))
}
pub fn geom_cooks_contour_with(self, geom: GeomCooksContour) -> Self {
let mut data = DataFrame::new();
data.add_column(".cooks".into(), vec![Value::Float(0.0)]);
self.add_geom_with(geom).layer_data(data)
}
pub fn geom_stepribbon(self) -> Self {
self.add_geom(GeomStepribbon::default())
}
pub fn geom_stepribbon_with(self, geom: GeomStepribbon) -> Self {
self.add_geom_with(geom)
}
pub fn stat_ecdf(self) -> Self {
self.add_geom(GeomStep::default()).stat(StatEcdf)
}
pub fn stat_ecdf_band(self, level: f64) -> Self {
self.add_geom(GeomStepribbon::default())
.stat(StatEcdfBand::new(level))
}
pub fn geom_censor_marks(self, censor_col: &str) -> Self {
self.add_geom(GeomCensorMarks::default())
.stat(StatCensored::new(censor_col))
}
pub fn geom_censor_marks_with(self, geom: GeomCensorMarks, censor_col: &str) -> Self {
self.add_geom_with(geom).stat(StatCensored::new(censor_col))
}
pub fn geom_errorbarh(self) -> Self {
self.add_geom(GeomErrorbarh::default())
}
pub fn geom_errorbarh_with(self, geom: GeomErrorbarh) -> Self {
self.add_geom_with(geom)
}
}