velociplot/
lib.rs

1//! # velociplot 🦖
2//!
3//! > Scientific plotting at velociraptor speed
4//!
5//! **velociplot** is a fast, publication-quality plotting library for Rust.
6//! Quick, precise, and deadly effective for creating scientific figures.
7//!
8//! ## Quick Start
9//!
10//! ```rust,ignore
11//! use velociplot::prelude::*;
12//!
13//! // Simple line plot
14//! plot()
15//!     .line(x, y)
16//!     .xlabel("Time (s)")
17//!     .ylabel("Temperature (K)")
18//!     .save("figure.png")?;
19//! ```
20//!
21//! ## Features
22//!
23//! - 🦖 **Blazingly Fast** - High-performance rendering
24//! - 📊 **Publication Quality** - LaTeX, vector output, precise control
25//! - 📐 **Scientific Plots** - Line, scatter, histogram, heatmap, contour
26//! - 🎨 **Beautiful Defaults** - Perceptually uniform colormaps
27//! - 🔧 **Ergonomic API** - Simple for basics, powerful for complex
28
29#![warn(missing_docs)]
30#![warn(clippy::all)]
31#![warn(clippy::pedantic)]
32#![allow(clippy::module_name_repetitions)]
33
34/// Core plotting types and traits
35pub mod core;
36
37/// Rendering backends
38pub mod backend;
39
40/// Figure and subplot management
41pub mod figure {
42    //! High-level figure composition
43}
44
45/// Plot types (line, scatter, bar, etc.)
46pub mod plots;
47
48/// Color definitions and utilities
49pub mod color;
50
51/// Axes, labels, and ticks
52pub mod axes;
53
54/// Legend rendering
55pub mod legend;
56
57/// Text rendering and math notation support
58pub mod text;
59
60/// Data integration (ndarray, polars, etc.)
61pub mod integration;
62
63/// Output formats (PNG, PDF, SVG)
64pub mod output {
65    //! Various output format writers
66}
67
68/// Style presets and themes
69pub mod style {
70    //! Styling and theming
71}
72
73/// Error types
74pub mod error {
75    //! Error definitions
76
77    use thiserror::Error;
78
79    /// Main error type for velociplot
80    #[derive(Error, Debug)]
81    pub enum Error {
82        /// IO error
83        #[error("IO error: {0}")]
84        Io(#[from] std::io::Error),
85
86        /// Invalid data
87        #[error("Invalid data: {0}")]
88        InvalidData(String),
89
90        /// Rendering error
91        #[error("Rendering error: {0}")]
92        Rendering(String),
93    }
94
95    /// Result type alias
96    pub type Result<T> = std::result::Result<T, Error>;
97}
98
99/// Prelude for convenient imports
100pub mod prelude {
101    //! Convenient re-exports
102    //!
103    //! ```rust
104    //! use velociplot::prelude::*;
105    //! ```
106
107    pub use crate::axes::{Axis, AxisPosition, LabelAlignment};
108    pub use crate::color::{Color, Colormap, Palette};
109    pub use crate::core::{Bounds, Canvas, DataSeries, Drawable, Point2D, Series};
110    pub use crate::error::{Error, Result};
111    pub use crate::legend::{
112        BarLegend, BarLegendPosition, HorizontalAlignment, Legend, LegendEntry, LegendPosition,
113        LegendShape, MarkerShape as LegendMarker,
114    };
115    pub use crate::plots::area::{AreaPlot, StackedAreaPlot};
116    pub use crate::plots::bar::{BarOrientation, BarPlot};
117    pub use crate::plots::boxplot::{BoxPlot, OutlierMethod};
118    pub use crate::plots::bubble::BubbleChart;
119    pub use crate::plots::datelistplot::{DateListPlot, DateListStyle};
120    pub use crate::plots::heatmap::{Heatmap, ValueFormat};
121    pub use crate::plots::histogram::{BinStrategy, Histogram};
122    pub use crate::plots::line::LinePlot;
123    pub use crate::plots::qq::{Distribution, PPPlot, QQPlot};
124    pub use crate::plots::scatter::{MarkerShape, MarkerStyle, ScatterPlot};
125    pub use crate::plots::stacked_bar::StackedBarPlot;
126    pub use crate::plots::timeline::{Timeline, TimelineOrientation};
127    pub use crate::plots::treemap::Treemap;
128    pub use crate::plots::violin::{Kernel, ViolinPlot};
129    pub use crate::text::{parse_math, MathNotation};
130
131    #[cfg(feature = "raster")]
132    pub use crate::backend::SkiaCanvas;
133
134    pub use crate::backend::SvgCanvas;
135}
136
137// Re-exports
138pub use error::{Error, Result};
139
140#[cfg(test)]
141mod tests {
142    #[test]
143    fn test_placeholder() {
144        // Placeholder test
145        assert_eq!(2 + 2, 4);
146    }
147}