| Crates.io | velociplot |
| lib.rs | velociplot |
| version | 0.1.0 |
| created_at | 2025-11-18 22:36:49.286561+00 |
| updated_at | 2025-11-20 16:55:04.004205+00 |
| description | Fast, publication-quality scientific plotting library - Quick, precise, and deadly effective |
| homepage | https://github.com/ibrahimcesar/velociplot |
| repository | https://github.com/ibrahimcesar/velociplot |
| max_upload_size | |
| id | 1939092 |
| size | 2,447,995 |
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.
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.
Early Development - Basic plotting is now functional!
Current version: 0.0.1-alpha
β What works now:
π§ Coming soon: More plot types (scatter points, bar, histogram), SVG/PDF output, LaTeX math rendering
use velociplot::prelude::*;
// Create data - a simple parabola
let data = Series::from_function(0.0, 10.0, 50, |x| x * x);
// Create and customize the plot
let plot = LinePlot::new(data)
.color(Color::from_hex("#1f77b4").unwrap())
.line_width(2.5);
// Set up canvas and render
let bounds = plot.bounds().unwrap().with_padding(0.1);
let mut canvas = SkiaCanvas::new(800, 600, bounds)?;
canvas.fill_background(&Color::WHITE.to_rgba())?;
// Add axes with grid
let x_axis = Axis::new(AxisPosition::Bottom)
.label("X")
.show_grid(true);
let y_axis = Axis::new(AxisPosition::Left)
.label("Y = XΒ²")
.show_grid(true);
x_axis.draw(&mut canvas)?;
y_axis.draw(&mut canvas)?;
plot.draw(&mut canvas)?;
// Add legend
if let Some(entry) = plot.legend_entry() {
let legend = Legend::new()
.add_entry(entry)
.position(LegendPosition::UpperRight);
legend.draw(&mut canvas)?;
}
// Save to PNG
canvas.save_png("plot.png")?;
See examples/ for more including multi-series plots with legends!
You can use custom fonts for text rendering:
let mut canvas = SkiaCanvas::new(800, 600, bounds)?;
// Load a custom font from a file
canvas.load_font_from_file("path/to/your/font.ttf")?;
// Or load from bytes
let font_bytes = include_bytes!("../assets/MyFont.ttf");
canvas.load_font_from_bytes(font_bytes)?;
By default, velociplot uses JetBrains Mono embedded in the library.
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:
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 = Legend::new()
.add_entry(entry)
.position(LegendPosition::UpperRight)
.line_vertical_align(0.70); // 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:
cargo run --example legend_alignment_test
# 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.
# Add to Cargo.toml (not yet on crates.io)
[dependencies]
velociplot = { git = "https://github.com/ibrahimcesar/velociplot" }
Or build from source:
git clone https://github.com/ibrahimcesar/velociplot
cd velociplot
cargo build --release
cargo run --example basic_line
ndarraypolars DataFramesInspired by matplotlib, but Rust-native:
API Principles:
velociplot/
βββ velociplot-core/ # Core plotting engine
βββ velociplot-backend/ # Rendering backends (Cairo, Skia, etc.)
βββ velociplot-formats/ # Output formats (PDF, SVG, PNG)
βββ velociplot-styles/ # Style presets and themes
βββ velociplot-cli/ # Command-line tool (optional)
Contributions are welcome! This project is in early stages.
How to contribute:
Standing on the shoulders of giants:
MIT OR Apache-2.0
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 π¦β‘


Status: β Phase 1 Complete - Basic plotting now functional!
Star β this repo to follow development!
![]() Ibrahim Cesar π» π π‘ π€ π π§ β |
This project follows the all-contributors specification. Contributions of any kind welcome!