plotters-statistical 0.1.0

Statistical chart primitives (box, violin, ROC, PR, regularization-path, residual) as native plotters series
Documentation
//! # plotters-statistical
//!
//! Statistical chart primitives for [`plotters`](https://docs.rs/plotters),
//! packaged as reusable *series types* that plug into
//! [`ChartContext::draw_series`](plotters::chart::ChartContext::draw_series)
//! exactly like `plotters`' own built-in `Histogram` / `LineSeries` /
//! `CandleStick`.
//!
//! Every chart type in this crate is a composite element that follows the same
//! [`Drawable`](plotters::element::Drawable) +
//! [`PointCollection`](plotters::element::PointCollection) pattern `plotters`
//! uses internally (its `CandleStick` element is the closest analogue), so they
//! feel native rather than bolted on.
//!
//! ## Chart types
//!
//! | Type | Replaces (matplotlib / seaborn) |
//! |------|---------------------------------|
//! | [`BoxPlot`] / [`BoxPlotSeries`] | `matplotlib.boxplot`, `seaborn.boxplot` |
//! | [`ViolinPlot`] / [`ViolinPlotSeries`] | `seaborn.violinplot` |
//! | [`RocCurve`] | `sklearn.metrics.RocCurveDisplay` |
//! | [`PrecisionRecallCurve`] | `sklearn.metrics.PrecisionRecallDisplay` |
//! | [`RegularizationPath`] | `sklearn` coefficient-path plots |
//! | [`ResidualPlot`] | `seaborn.residplot` |
//!
//! ## Design: math is separate from rendering
//!
//! All numeric work lives in [`stats`] and has no `plotters` dependency, so it
//! can be unit-tested against hand-computed values. The [`series`] types only
//! turn already-computed geometry into `plotters` draw calls.
//!
//! ## Quick start
//!
//! ```no_run
//! use plotters::prelude::*;
//! use plotters_statistical::BoxPlotSeries;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let root = SVGBackend::new("boxes.svg", (640, 480)).into_drawing_area();
//! root.fill(&WHITE)?;
//! let mut chart = ChartBuilder::on(&root)
//!     .margin(20)
//!     .set_label_area_size(LabelAreaPosition::Left, 40)
//!     .set_label_area_size(LabelAreaPosition::Bottom, 40)
//!     .build_cartesian_2d(0f64..3f64, 0f64..10f64)?;
//! chart.configure_mesh().draw()?;
//!
//! let groups = vec![
//!     (1.0, vec![1.0, 2.0, 2.5, 3.0, 9.0]),
//!     (2.0, vec![2.0, 3.0, 3.5, 4.0, 4.2]),
//! ];
//! chart.draw_series(BoxPlotSeries::from_samples(groups)?)?;
//! root.present()?;
//! # Ok(())
//! # }
//! ```
#![warn(missing_docs)]

pub mod colormap;
pub mod figures;
pub mod stats;
pub mod style;

pub mod series;

#[doc(inline)]
pub use series::{
    BoxPlot, BoxPlotSeries, BoxStyle, CalibrationCurve, Ecdf, GainChart, Heatmap,
    PrecisionRecallCurve, QqPlot, RegLine, RegularizationPath, ResidualPlot, RocCurve, ViolinPlot,
    ViolinPlotSeries, ViolinStyle,
};

#[doc(inline)]
pub use colormap::{GradientColorMap, Normalization};

#[doc(inline)]
pub use figures::{CorrelationHeatmap, MissingnessHeatmap, PairPlot};

#[doc(inline)]
pub use stats::StatsError;