Quill đĒļ
A lightweight Rust plotting library for creating simple 2D plots. Quill is designed for simplicity and ease of use, making it perfect for generating basic plots for reports, examples, or any application that needs clean, vector-based visualizations.
Features
- đ¨ Basic Styling: Choose colors, marker types, and line styles
- đ Simple Layouts: Configurable dimensions, titles, axis labels, legends, and grids
- đ§ Builder Pattern: Clean API with method chaining
- đ Multiple Data Series: Support for multiple datasets on a single plot
- đŧī¸ SVG Output: Export to SVG files or return as
svg::Documentfor programmatic use - đŧī¸ PNG Support: Optional PNG output via
pngfeature - ⥠Lightweight: Minimal dependencies for fast compilation
Quick Start
Add Quill to your Cargo.toml:
[]
= "0.1.6"
Basic Line Plot
use *;
Examples
Line Plot
A simple sine wave visualization with connected points:
use *;
let line_plot = builder
.dimensions
.title
.x_label
.y_label
.legend
.grid
.data
.build;
Scatter Plot
Data points without connecting lines:
use *;
let scatter_plot = builder
.dimensions
.title
.legend
.grid
.data
.build;
Multi-Series Plot
Multiple datasets on the same plot:
use *;
let plot = builder
.dimensions
.title
.x_label
.y_label
.legend
.grid
.data
.build;
Investment Growth Data
Points with different line styles:
use *;
let plot = builder
.dimensions
.title
.x_label
.y_label
.x_range
.legend
.grid
.font
.data
.build;
API Overview
Plot Builder
Configure your plot with the builder pattern:
builder
.dimensions // Plot size
.title // Chart title
.x_label // X-axis label
.y_label // Y-axis label
.x_range // X-axis range (Auto or Manual)
.y_range // Y-axis range (Auto or Manual)
.legend // Legend position
.grid // Grid style
.font // Font family
.margin // Plot margins
.data // Data series
.build
Series Builder
Define data series with markers and line styling:
builder
.name // Legend name
.color // Line/marker color
.data // Data points (f32, f64, i32, or i64 tuples)
.marker // Point markers
.marker_size // Marker size
.line // Line style (or Line::None for scatter)
.build
Output Options
// Save to SVG file
plot.to_svg.unwrap;
// Get SVG document for programmatic use
let svg_doc: Document = plot.to_document;
Example of Available Options
Markers
Marker::None- No markersMarker::Circle- Circular pointsMarker::Square- Square pointsMarker::Cross- Cross markers
Line Styles
Line::Solid- Solid linesLine::Dashed- Dashed linesLine::Dotted- Dotted linesLine::None- No connecting lines
Grid Styles
Grid::Solid- Solid grid linesGrid::Dashed- Dashed grid linesGrid::Dotted- Dotted grid linesGrid::None- No grid
Legend Positions
Legend::TopLeftInsideLegend::TopRightInsideLegend::TopRightOutsideLegend::BottomLeftInsideLegend::BottomRightInsideLegend::BottomRightOutsideLegend::LeftCenterInsideLegend::RightCenterInsideLegend::RightCenterOutsideLegend::TopCenterLegend::BottomCenterLegend::None
License
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.