-
Notifications
You must be signed in to change notification settings - Fork 3
Development
Tobias Reiher edited this page Dec 19, 2024
·
2 revisions
plotters::style::Palette99 includes the following 20 colors:
Script to generate the image
use plotters::prelude::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let root_drawing_area = SVGBackend::new("palette.svg", (700, 300)).into_drawing_area();
let child_drawing_areas = root_drawing_area.split_evenly((3, 7));
for (color, area) in child_drawing_areas.into_iter().enumerate() {
area.fill(&Palette99::pick(color))?;
area.draw(&Text::new(
format!("{color}"),
(37, 37),
("sans-serif", 25.0).into_font(),
))?;
}
root_drawing_area.present()?;
Ok(())
}
To achieve a consistent style, use the following approach:
- For totals, use area plots. The area has the same color as the line, but with less opacity.
- For averages, use line plots. For raw values or other additional information, use band plots with the same color as the average, but with less opacity.