plotters_statistical/figures/
mod.rs1pub mod colorbar;
10pub mod correlation_heatmap;
11pub mod missingness_heatmap;
12pub mod pair_plot;
13
14pub use correlation_heatmap::CorrelationHeatmap;
15pub use missingness_heatmap::MissingnessHeatmap;
16pub use pair_plot::{Diagonal, PairPlot};
17
18use plotters::prelude::*;
19use plotters::style::text_anchor::{HPos, Pos, VPos};
20
21pub(crate) fn text_style<'a>(h: HPos, v: VPos, size: i32, color: &'a RGBColor) -> TextStyle<'a> {
25 TextStyle::from(("sans-serif", size).into_font())
26 .color(color)
27 .pos(Pos::new(h, v))
28}
29
30pub(crate) fn contrast_text(bg: RGBColor) -> RGBColor {
32 let l = 0.299 * bg.0 as f64 + 0.587 * bg.1 as f64 + 0.114 * bg.2 as f64;
33 if l > 140.0 {
34 RGBColor(0, 0, 0)
35 } else {
36 RGBColor(255, 255, 255)
37 }
38}