Velociplot π¦
Scientific plotting at velociraptor speed
velociplot (Velociraptor + plot) is a fast, publication-quality plotting library for Rust. Quick, precise, and deadly effective for creating scientific figures.
π― What is velociplot?
Veloci-plot = Velocity + plot
Like a velociraptor: quick, precise, and deadly effective
A pure Rust plotting library designed for scientists, engineers, and developers who need high-performance, publication-ready visualizations.
β¨ Features (Planned)
- π¦ Blazingly Fast - Plot millions of points in milliseconds
- π Publication Quality - LaTeX math, precise DPI control, vector output
- π Scientific Plots - Line, scatter, histogram, heatmap, contour, 3D surface
- π¨ Beautiful Defaults - Perceptually uniform colormaps, colorblind-friendly
- π Multiple Formats - PDF, SVG, PNG, EPS (vector + raster)
- π§ Ergonomic API - Simple for basics, powerful for complex figures
- π Pure Rust - No Python/matplotlib required
π§ Status
Early Development - Basic plotting is now functional!
Current version: 0.0.1-alpha
β What works now:
- β Line plots with customizable colors and widths
- β Axes with tick marks and labels
- β Grid lines
- β Legends with automatic positioning
- β Text rendering (axis labels, legend text, annotations)
- β PNG output via tiny-skia backend
- β Data from functions, vectors, or tuples
- β Automatic bounds calculation
- β Pure Rust, no C dependencies
π§ Coming soon: More plot types (scatter points, bar, histogram), SVG/PDF output, LaTeX math rendering
π Quick Example
use *;
// Create data - a simple parabola
let data = from_function;
// Create and customize the plot
let plot = new
.color
.line_width;
// Set up canvas and render
let bounds = plot.bounds.unwrap.with_padding;
let mut canvas = new?;
canvas.fill_background?;
// Add axes with grid
let x_axis = new
.label
.show_grid;
let y_axis = new
.label
.show_grid;
x_axis.draw?;
y_axis.draw?;
plot.draw?;
// Add legend
if let Some = plot.legend_entry
// Save to PNG
canvas.save_png?;
See examples/ for more including multi-series plots with legends!
Custom Fonts
You can use custom fonts for text rendering:
let mut canvas = new?;
// Load a custom font from a file
canvas.load_font_from_file?;
// Or load from bytes
let font_bytes = include_bytes!;
canvas.load_font_from_bytes?;
By default, velociplot uses JetBrains Mono embedded in the library.
Legend Customization
Understanding Vertical Alignment
Legends display a colored line next to text labels. The vertical alignment determines where that line appears relative to the text. Different fonts have different proportions (x-height, ascenders, descenders), so the "visually centered" position varies.
Why this matters:
- Typography has multiple reference points: baseline, x-height, cap-height
- The optical center (where text "feels" centered) isn't at 50% of the text box
- Most lowercase letters (a, e, o, n) sit on the baseline and extend to the x-height
- The visual center is typically around the middle of the x-height
How it works:
Text Box: βββββββββββ β 0.0 (top)
β T β
β e ββββ 0.70 (default - optical center)
β x β
β t ββββ 0.75 (baseline)
βββββββββββ β 1.0 (bottom)
Fine-tune the alignment to match your font:
let legend = new
.add_entry
.position
.line_vertical_align; // 0.0 = top, 1.0 = bottom
Recommended values:
0.55- Higher (fonts with large x-height like Verdana)0.65- Geometric center of x-height0.70- Default (optimized for JetBrains Mono)0.75- Baseline (mathematical horizontal reference)
Testing your font:
# Generates 6 comparison plots (0.50, 0.55, 0.60, 0.65, 0.70, 0.75)
# Open the PNG files and pick the one that looks best centered
The default (0.70) was chosen after visual testing with JetBrains Mono, the embedded font. If you load a custom font, you may want to adjust this value.
π¦ Installation
# Add to Cargo.toml (not yet on crates.io)
[]
= { = "https://github.com/ibrahimcesar/velociplot" }
Or build from source:
πΊοΈ Roadmap
Phase 1: Foundation β DONE!
- Core architecture and traits
- Basic 2D coordinate system
- Simple line plots
- PNG output (raster via tiny-skia)
- Color and style system
Phase 2: Core Plots
- Bar charts and histograms
- Error bars and bands
- Multiple series support
- Legend and annotations
- Axis customization (labels, limits, scales)
Phase 3: Publication Quality
- LaTeX math rendering
- Vector output (PDF, SVG, EPS)
- DPI and size control
- Multiple subplots and layouts
- Publication templates (Nature, Science, IEEE, ACS)
Phase 4: Advanced Plots
- Heatmaps and colormaps
- Contour plots
- 3D surface plots
- Polar plots
- Vector fields (quiver)
Phase 5: Ecosystem Integration
- Integration with
ndarray - Integration with
polarsDataFrames - Jupyter notebook support
- CLI tool for quick plotting
- Python bindings (PyO3)
π¨ Design Philosophy
Inspired by matplotlib, but Rust-native:
- β Performance - 10-100x faster than Python/matplotlib
- β Type Safety - Catch errors at compile time
- β No Dependencies - No Python, no C libraries (for core features)
- β Modern Defaults - Beautiful out-of-the-box
- β Progressive Disclosure - Easy to start, powerful when needed
API Principles:
- Simple one-liners for common tasks
- Builder pattern for complex figures
- Method chaining for fluent API
- Sensible defaults (but full control when needed)
π― Use Cases
- Academic Papers - Publication-ready figures with LaTeX
- Data Analysis - Quick exploratory plots
- Engineering - Technical visualizations and reports
- Real-time Monitoring - High-performance streaming plots
- Web Services - Generate plots server-side (no GUI needed)
π§ Architecture
π€ Contributing
Contributions are welcome! This project is in early stages.
How to contribute:
- π Report bugs or suggest features via Issues
- π» Submit PRs for bug fixes or features
- π Improve documentation
- π¨ Create plot examples or style templates
- π§ͺ Add test cases
π Documentation
- API Documentation (coming soon)
- User Guide (coming soon)
- Examples Gallery (coming soon)
π Acknowledgments
Standing on the shoulders of giants:
- matplotlib - The gold standard for scientific plotting
- plotters - Rust plotting pioneer
- egui_plot - Interactive plotting in Rust
- poloto - SVG plotting techniques
- resvg - SVG rendering
π License
MIT OR Apache-2.0
π¦ Why "velociplot"?
Because your scientific plots should be as fast and efficient as a velociraptor hunting prey. No more waiting minutes for matplotlib to render complex figures!
velociplot - Because your plots shouldn't take ages to render π¦β‘
πΈ Example Output
Basic Line Plot

Multiple Series

Status: β Phase 1 Complete - Basic plotting now functional!
Star β this repo to follow development!
Contributors
This project follows the all-contributors specification. Contributions of any kind welcome!