Skip to main content

lichtung_plot/
lib.rs

1//! A strongly typed scientific plotting and SVG rendering library.
2//!
3//! Complete immutable theme values and their built-in constructors are available
4//! from the crate root:
5//! ```
6//! let _ = lichtung_plot::Theme::publication();
7//! ```
8//!
9//! Canvas selects a complete root theme from its explicit or construction-default
10//! slot. Child Plots without an explicit theme inherit that effective value:
11//! ```
12//! use lichtung_plot::{Canvas, NumericValues, Plot, Theme};
13//!
14//! let canvas = Canvas::grid(1, 2)?
15//!     .theme(Theme::nature())
16//!     .panel(0, 0, Plot::scatter(
17//!         NumericValues::new("x", [1.0, 2.0]),
18//!         NumericValues::new("y", [1.0, 2.0]),
19//!     ))?
20//!     .panel(0, 1, Plot::scatter(
21//!         NumericValues::new("x", [1.0, 2.0]),
22//!         NumericValues::new("y", [2.0, 1.0]),
23//!     ).theme(Theme::science()))?;
24//! # let _ = canvas;
25//! # Ok::<(), lichtung_plot::Error>(())
26//! ```
27//!
28//! Specialized values live in their functional modules. The complete root
29//! Theme and Color types have one public path:
30//! ```compile_fail
31//! use lichtung_plot::theme::Theme;
32//! ```
33//!
34//! The plot module exposes configuration, not implementation routines:
35//! ```compile_fail
36//! use lichtung_plot::plots::line;
37//! ```
38//! ```compile_fail
39//! use lichtung_plot::AlphaEncoding;
40//! ```
41//!
42//! Common line patterns can be used in complete theme strokes and reference
43//! guides without converting between types:
44//! ```
45//! use lichtung_plot::{Color, elements::GuideStyle, style::LinePattern, theme::StrokeTheme};
46//! let pattern = LinePattern::MediumDash;
47//! let stroke = StrokeTheme::new(Color::rgb(80, 120, 140), 1.5, pattern)?;
48//! let guide = GuideStyle::new(stroke.get_color(), stroke.get_width(), stroke.get_pattern())?;
49//! assert_eq!(guide.get_pattern(), pattern);
50//! # Ok::<(), lichtung_plot::Error>(())
51//! ```
52//!
53//! Public scale identities may grow in later releases:
54//! ```compile_fail
55//! use lichtung_plot::scales::ContinuousScaleKind;
56//! fn name(kind: ContinuousScaleKind) -> &'static str {
57//!     match kind {
58//!         ContinuousScaleKind::Sequential => "sequential",
59//!         ContinuousScaleKind::Diverging => "diverging",
60//!     }
61//! }
62//! ```
63//!
64//! Decoration rendering is also private:
65//! ```compile_fail
66//! use lichtung_plot::decorations::title_block::TitleBlock;
67//! ```
68//!
69//! ```compile_fail
70//! use lichtung_plot::layout::Layout;
71//! ```
72//!
73//! Alpha inputs are exported through scales; internal preparation stays private:
74//! ```compile_fail
75//! use lichtung_plot::alpha::AlphaTarget;
76//! ```
77
78#![deny(missing_docs)]
79
80mod alpha;
81mod builder;
82mod canvas;
83/// Scientific input values and raw source identities.
84pub mod data;
85mod decorations;
86mod error;
87/// Typed failure reasons and operation effects.
88pub mod errors;
89mod font;
90mod geometry;
91mod input;
92/// Plot-family markers and sealed configuration capabilities.
93pub mod kind;
94mod labels;
95mod layers;
96/// Layout and absolute publication-size configuration.
97pub mod layout;
98mod numeric;
99/// Cancellation and resource options for a single native operation.
100pub mod operation;
101mod orchestrator;
102/// Publication options.
103pub mod output;
104/// Plot-family identities, scientific inputs and plot-specific configuration.
105pub mod plots;
106mod render;
107mod scene;
108mod significance;
109mod spec;
110/// Display-only statistics (KDE, CI, OLS for fit lines).
111pub mod stats;
112/// Font configuration, text layout and positioning.
113pub mod text;
114/// Complete theme components and immutable theme construction.
115pub mod theme;
116mod values;
117
118/// Coordinate axes, positions, domains and tick policies.
119pub mod coordinates;
120/// Additional plot layers, annotations and significance declarations.
121pub mod elements;
122/// Scientific labels, number presentation and formatter contexts.
123pub mod formatting;
124/// Legend and guide configuration.
125pub mod guides;
126/// Scientific color and opacity encodings.
127pub mod scales;
128/// Shared mark styles and paint values.
129pub mod style;
130
131pub use builder::Plot;
132pub use canvas::Canvas;
133pub use elements::Layer;
134pub use error::{Error, Result};
135pub use numeric::format::NumericFormat;
136pub use output::value::Output;
137pub use text::value::Text;
138pub use theme::paint::Color;
139pub use theme::value::Theme;
140pub use values::{BooleanValues, CategoryValues, NumericValues};