piechart/piechart.rs
1use polars::prelude::*;
2
3use plotlars::{PieChart, Plot, Text};
4
5fn main() {
6 let dataset = LazyCsvReader::new(PlPath::new("data/penguins.csv"))
7 .finish()
8 .unwrap()
9 .select([col("species")])
10 .collect()
11 .unwrap();
12
13 PieChart::builder()
14 .data(&dataset)
15 .labels("species")
16 .hole(0.4)
17 .pull(0.01)
18 .rotation(20.0)
19 .plot_title(Text::from("Pie Chart").font("Arial").size(18))
20 .build()
21 .plot();
22}