| Crates.io | fluent-plots |
| lib.rs | fluent-plots |
| version | 0.1.0 |
| created_at | 2025-07-14 19:42:52.467195+00 |
| updated_at | 2025-07-14 19:42:52.467195+00 |
| description | A declarative data visualization library with a fluent API, built on Polars and Charming. |
| homepage | |
| repository | https://github.com/jonfres/fluent-plots |
| max_upload_size | |
| id | 1752223 |
| size | 72,283 |
A declarative and easy-to-use Rust data visualization library for creating static and interactive charts from Polars DataFrames. fluent-plots provides a simple, chainable API for quickly building common plot types.
DataFrame Integration: Designed to work directly with the powerful Polars DataFrame.plotters (drawing logic still in development).charming and ECharts.js.Add fluent-plots to your Cargo.toml file.
For interactive charts, enable the interactive feature:
[dependencies]
fluent-plots = { version = "0.1.0", features = ["interactive"] }
polars = { version = "0.41", features = ["csv"] } # Needed for the examples
If you only need the static plotting capabilities (once implemented), you can omit the feature flag.
Here's how to create an interactive bar chart from a Polars DataFrame.
use fluent_plots::barchart;
use polars::prelude::*;
use std::fs;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. Create a DataFrame
let df = df!(
"category" => &["A", "B", "C", "D"],
"value" => &[10, 25, 5, 42],
)?;
// 2. Build the chart and generate the HTML
let html_content = barchart(df)
.x("category")
.y("value")
.to_interactive_html()?;
// 3. Save the HTML to a file
fs::write("my_interactive_chart.html", html_content)?;
Ok(())
}
You can easily create other chart types by calling linechart() or scatterplot().
use fluent_plots::linechart;
use polars::prelude::*;
use std::fs;
// ... create your DataFrame `df` ...
let html_content = linechart(df)
.x("category")
.y("value")
.to_interactive_html()?;
fs::write("my_line_chart.html", html_content)?;
This repository includes a test application in the plot-tester directory (if you choose to include it) that can be run from the command line to generate charts from a CSV file.
First, create a sample_data.csv file:
category,value
A,10
B,25
C,5
D,42
E,18
Then, run the application:
# Generate a bar chart (default)
cargo run -- sample_data.csv
# Generate a line chart
cargo run -- sample_data.csv line
# Generate a scatter plot
cargo run -- sample_data.csv scatter
This project is licensed under either of
at your option.
Contributions are welcome! Feel free to open an issue or submit a pull request.