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 owns one optional-to-call complete root theme. Unthemed child Plots inherit
10//! it, while an explicit Plot theme replaces it locally:
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//! Its implementation module is private:
29//! ```compile_fail
30//! use lichtung_plot::theme::Theme;
31//! ```
32//!
33//! Decoration rendering is also private:
34//! ```compile_fail
35//! use lichtung_plot::decorations::title_block::TitleBlock;
36//! ```
37//!
38//! ```compile_fail
39//! use lichtung_plot::layout::Layout;
40//! ```
41//!
42//! Alpha inputs are exported from the root; internal targets and preparation stay private:
43//! ```compile_fail
44//! use lichtung_plot::alpha::AlphaTarget;
45//! ```
46
47#![deny(missing_docs)]
48
49mod alpha;
50mod builder;
51mod canvas;
52mod data;
53mod decorations;
54mod error;
55mod font;
56mod geometry;
57mod input;
58/// Plot-family markers and sealed configuration capabilities.
59pub mod kind;
60mod labels;
61mod layers;
62mod layout;
63mod numeric;
64mod orchestrator;
65mod output;
66mod plots;
67mod render;
68mod scene;
69mod significance;
70mod spec;
71/// Display-only statistics (KDE, CI, OLS for fit lines).
72pub mod stats;
73mod text;
74mod theme;
75mod values;
76
77pub use alpha::{AlphaEncoding, AlphaSemantics, AlphaValues};
78pub use builder::Plot;
79pub use canvas::{Canvas, CanvasCategoryLabels, TextPanel};
80pub use error::{Error, Result};
81pub use font::canonical::{FontFamily, FontStack, GenericFontFamily};
82pub use geometry::{HistogramGeometry, RaincloudGeometry};
83pub use input::{AxisValues, HistogramInput, RaincloudInput};
84pub use labels::Labels;
85pub use layers::{BarPointLayer, GuideSpec, GuideStyle, PointLayer};
86pub use layout::AxisTick;
87pub use numeric::context::{
88    CoordinateAxis, NumericDomain, NumericFactors, NumericIdentity, NumericLabels, NumericOperand,
89    NumericOwner, NumericPurpose, NumericRangeOrigin, NumericRole, NumericSetContext, NumericValue,
90    NumericValueContext,
91};
92pub use numeric::decimal::{
93    NegativeZero, NumericNotation, NumericRadix, NumericRounding, TrailingZeros,
94};
95pub use numeric::emission::{
96    NumericAlignment, NumericField, NumericRate, NumericSign, NumericSymbol,
97};
98pub use numeric::format::{NumericFormat, NumericPrecision};
99pub use numeric::locale::{
100    NumericCurrency, NumericGroupRepeat, NumericGrouping, NumericLocale, NumericSymbols,
101};
102pub use numeric::prefixes::{
103    NumericCompactRule, NumericFactor, NumericPrefixes, NumericPromotion, NumericSelection,
104    SiPrefix,
105};
106pub use numeric::unit::{NumericExplanation, NumericUnit, NumericUnitPlacement};
107pub use output::Output;
108pub use render::backend::StrokePattern;
109pub use significance::{
110    Attached, FacetCell, Pairwise, Significance, SignificanceMark, SignificanceTarget,
111};
112pub use spec::{
113    AxisScale, BarInput, BarSamples, BarSpacing, Bootstrap, Bounds, CanvasLegendPolicy,
114    CategoricalColorMap, CategoryLabelSelection, CategoryOrder, CoefficientInput,
115    ConfidenceInterval, DataAreaCorner, DumbbellEndpoints, ErrorBar, EstimateStatus, FacetScales,
116    FacetSpec, HeatmapAnnotations, HeatmapLayout, HeatmapNullRowAnnotation, HistogramBins,
117    HistogramComposite, HistogramKde, HistogramStat, InteractionStyle, LabelEndpoints,
118    LegendComposition, LegendPolicy, LegendPosition, LinePathStyle, LinePattern,
119    PercentileInterval, PlotKind, PlotTextAnnotation, PointShape, QqLine, RawOverlay,
120    RegressionBand, SignificanceMarkStyle, StandardDeviation, StandardError, TextWeight,
121    TickContext, TickGeneration, TickPositions, TickRequirement, TickSingleton, TickSpace,
122    ValueSort, WaterfallLabels,
123};
124pub use spec::{PngCompression, PngOptions, PngSizing};
125pub use text::{
126    DataCoordinate, DataPosition, GuideTextRole, Text, TextAlignment, TextAnchor, TextBounds,
127    TextCoordinate, TextDirection, TextElision, TextEllipsis, TextFailure, TextFit,
128    TextFitGrouping, TextFitPriority, TextLayout, TextOffset, TextOffsetFrame, TextOrientation,
129    TextOverflow, TextOverlap, TextPosition, TextRotation, TextRotationMode, TextVisibility,
130    TextWrapping,
131};
132pub use theme::{
133    AccentPalette, AnnotationTextRoles, AnnotationTheme, AxisSpacing, AxisTextRoles, AxisTheme,
134    BandFillRoles, BodyFillRoles, CategoricalColorScale, CategoryMarkGeometry,
135    CellAnnotationGeometry, CellMarkRoles, Color, ColorDomain, ColorScales, ColorStop,
136    CompositionTextRoles, CompositionTheme, ConnectorStrokeRoles, ContinuousColorScale,
137    ContinuousScaleKind, ContrastTextRoles, CurveStrokeRoles, DataFillTheme, DataLineRoles,
138    DataLineTheme, DataOutlineTheme, DensityFillRoles, DivergingGradient,
139    EstimateAnnotationGeometry, FacetStripSpacing, FillRoles, FixedFillTheme, FrameSides,
140    FrameTheme, GradientLengths, GuideTextRoles, HeaderSpacing, LegendFrameTheme, LegendSpacing,
141    LegendTheme, MarkExtentTheme, MarkTheme, NeutralPaintRoles, OpaqueColor, OutlineTheme,
142    PaletteCapacity, PointOutlineTheme, PointRadii, PointRoles, PointTheme, QualitativePalette,
143    ReferenceStrokeRoles, RelativeSpacing, RootPadding, RootTextRoles, RootTitleSpacing,
144    SequentialGradient, SignificanceGeometry, SizedPointTheme, SolidStrokeTheme, StrokeRoles,
145    StrokeTheme, SummaryStrokeRoles, SupplementalPointTheme, SurfaceTheme, TextPanelSpacing,
146    TextTheme, Theme, ThemeBuilder, TickTheme, TypographyTheme, ValueShelfSpacing,
147};
148pub use values::{BooleanValues, CategoryValues, NumericValues, SourceRows};