Use Plotters to draw plots in Druid.
This draws the basic x² plot from the plotters example, filling out the entire window. The size of the plotting area changes when resizing the window.
cargo run --example simpleIn this example we use a value from the druid data to manipulate the plot.
cargo run --example interactiveThere's a lot of 0.x versions floating around here, so I've
assembled a table to help you figure out which version of plotters-druid or
plotters-piet you need.
| druid | plotters-druid | piet-common | plotters-piet | plotters |
|---|---|---|---|---|
| 0.7.0 | 0.2.0 | 0.3.2 | 0.3.1 | 0.3 |
| 0.8.2 / 0.8.3 | 0.3.0 | 0.6.1 / 0.6.2 | 0.3.2 | 0.3 |
| commit b27ea6a | commit 44f35a0 | 0.7.0-cairo18 | 0.3.3 | 0.3 |
| >= 0.4, < 0.9 | 0.3.4 | 0.3 |
If you run into problems with multiple versions of piet in your dependency
graph then check out the dependency duplication
section of the Cargo Book. cargo update with the --precise
flag should usually be able to fix the issue.
See also this cargo issue for more information about version ranges.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.

