1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! # 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(())
//! # }
//! ```
pub use ;
pub use ;
pub use ;
pub use StatsError;