12 releases (breaking)

0.10.0 Feb 17, 2024
0.9.0 Jul 29, 2023
0.8.0 Apr 13, 2023
0.7.0 Feb 21, 2023
0.1.2 Jul 2, 2021

#30 in Visualization

Download history 157/week @ 2024-01-01 336/week @ 2024-01-08 208/week @ 2024-01-15 326/week @ 2024-01-22 195/week @ 2024-01-29 258/week @ 2024-02-05 409/week @ 2024-02-12 288/week @ 2024-02-19 231/week @ 2024-02-26 218/week @ 2024-03-04 241/week @ 2024-03-11 210/week @ 2024-03-18 148/week @ 2024-03-25 351/week @ 2024-04-01 450/week @ 2024-04-08 218/week @ 2024-04-15

1,190 downloads per month
Used in 3 crates

MIT license

894 lines


Test and Build Documentation Crates.io License

This is an implementation of an Iced backend for Plotters, for both native and wasm applications.

This backend has been optimized as for speed. Note that some specific plotting features supported in the Bitmap backend may not be implemented there, though.


CPU Monitor Example

WASM Example

What is Plotters?

Plotters is an extensible Rust drawing library that can be used to plot data on nice-looking graphs, rendering them through a plotting backend (eg. to a Bitmap image raw buffer, to your GUI backend, to an SVG file, etc.).

For more details on Plotters, please check the following links:

How to install?

Include plotters-iced in your Cargo.toml dependencies:

plotters-iced = "0.10"
iced = { version = "0.12", features = ["canvas", "tokio"] }

How to use?

First, import Chart and ChartWidget:

use plotters_iced::{Chart, ChartWidget, DrawingBackend, ChartBuilder};

Then, derive Chart trait and build your chart, and let plotters-iced takes care the rest:

struct MyChart;
impl Chart<Message> for MyChart {
    type State = ();
    fn build_chart<DB:DrawingBackend>(&self, state: &Self::State, builder: ChartBuilder<DB>) {
        //build your chart here, please refer to plotters for more details

Finally, render your chart view:

impl MyChart {
    fn view(&mut self)->Element<Message> {

If you are looking for a full example of an implementation, please check cpu-monitor.rs.

How to run the examples?

Example #1: cpu-monitor

This example samples your CPU load every second, and renders it in a real-time chart:

cargo run --release --example cpu-monitor

From this example, you'll learn:

  • how to build charts by plotters-iced
  • how to feed data to charts
  • how to make layouts of charts responsive
  • how to use fonts with charts

Example #2: split-chart

This example shows you how to split drawing area.

  • run the native version
cargo run --release --example split-chart
  • run the web version
cd examples/split-chart
trunk serve

Are there any limitations?

Limitation #1: No image rendering

No image rendering for native and wasm applications.

Limitation #2: Limited text rendering for native applications

Only TTF font family are supported for text rendering, which is a limitation of Iced, please look at cpu-monitor.rs. As well, font transforms are not supported,which is also a limitation of Iced.



~1M SLoC