
Hi,
I’ve been working on a Rust plotting library called Charton. I wanted to bring a true "Grammar of Graphics" experience to Rust, similar to what Altair does for Python or ggplot2 for R.
I’ve always felt that many Rust plotting tools are either too low-level—where you have to write dozens of lines just for a simple chart—or they’re just too rigid. To fix this, I built Charton with a custom Dataset engine that feels a lot like Polars. You can feed it native arrays, vectors, or Polars DataFrames directly, and it handles the data very efficiently.
The API is minimal by design. In most cases, you can get a plot done in a single line. It uses a layered approach, so you can stack different marks to build complex visualizations. Right now, it supports 9 core types: points, bars, lines, area, rect, boxplots, rules, ticks, and text.
Here’s a quick look at how you’d use it:
let height = vec![160.0, 170.0, 180.0];
let weight = vec![60.0, 75.0, 85.0];
chart!(height, weight)?
.mark_point()?
.encode((alt::x("height"), alt::y("weight")))?
.save("out.svg")?;
And for layered chart:
// Create individual layers
let line = chart!(height, weight)?.mark_line()?.encode((alt::x("height"), alt::y("weight")))?;
let point = chart!(height, weight)?.mark_point()?.encode((alt::x("height"), alt::y("weight")))?;
// Combine into a composite chart
line.and(point).save("layered.svg")?;
Next on my list is adding a WGPU backend for hardware acceleration and integrating with Nushell for terminal-based plotting.
However, I’m curious to hear from the community: What are you looking for in a Rust plotting library? In what direction should Charton evolve to best fit the current trends in the Rust ecosystem?