dataviz-0.1.3 has been yanked.
DataViz π
A modular, customizable, and feature-rich 2D plotting library written in Rust. With DataViz, you can create a wide variety of plots tailored to your needs, supporting both raster (PNG) and vector (SVG) outputs.
Features
Supported Plot Types
- Bar Charts: Create grouped horizontal and vertical bar charts.
- Scatter Graphs: Visualize data points with various shapes (circle, square, triangle, etc.).
- Pie Charts: Represent data proportions as slices of a circle.
- Area Charts: Highlight trends with filled areas under data lines.
- Histograms: Analyze frequency distributions with dynamic bin calculations.
- Cartesian Graphs: Plot mathematical functions or datasets on a coordinate plane.
- Quadrant 1 Graphs: Focused plotting in the first quadrant for non-negative data.
Customization Options
- Title: Add meaningful titles to your plots.
- Axes Labels: Define X-axis and Y-axis labels.
- Dynamic Scaling: Automatically fit data within the plot dimensions.
- Colors: Customize colors for the background, axes, and data elements.
- Margins: Add space around the plot for better visibility.
- Line and Dot Styles: Customize line types (solid, dashed, dotted) and dot shapes (circle, square, cross, triangle).
Output Formats
- Raster (PNG): Save high-quality images of your plots.
- Vector (SVG): Generate scalable vector graphics for precision and scalability.
Interactive Capabilities
- Hover effects and real-time updates (coming soon).
Examples
PNG Outputs
SVG Outputs
Installation
Add the following dependencies to your Cargo.toml
file:
[]
= "0.2.29" # Font rendering
= "0.25" # Raster image generation
= "0.25.0" # Image processing
= "0.27.0" # Simple framebuffer support
= "0.8.5" # Optional, for generating random test data
= "0.44.0" # SVG rendering
= "0.9.3" # Font processing
Usage Example
use PieChart;
use FigureConfig;
let figure_config = FigureConfig ;
let mut pixel_canvas = new;
let mut bar_chart = new;
let mut dataset1 = new;
dataset1.add_data;
dataset1.add_data;
dataset1.add_data;
let mut dataset2 = new;
dataset2.add_data;
dataset2.add_data;
dataset2.add_data;
let mut dataset3 = new;
dataset3.add_data;
dataset3.add_data;
dataset3.add_data;
let mut dataset4 = new;
dataset4.add_data;
dataset4.add_data;
dataset4.add_data;
bar_chart.add_dataset;
bar_chart.add_dataset;
bar_chart.add_dataset;
bar_chart.add_dataset;
bar_chart.draw_svg;
pixel_canvas
.save
.unwrap;
let svg_text = pixel_canvas.get_svg_as_text;
display_svg;
let handle = spawn;
handle.join.unwrap;
License
This project is licensed under the MIT. See the LICENSE
file for details.
Contributing
We welcome contributions to make Plotter Library even better!
- Report bugs and suggest features through GitHub Issues.
- Submit pull requests for enhancements or fixes.
Letβs make data visualization in Rust easy and accessible!
Happy Plotting! π