Pie and donut

Polar
The same category counts as a pie and as a donut, with a configurable hole.

mark_pie() and mark_donut() take a value and a fill. A donut is a pie with a hole.

peng <- na.omit(datasets::penguins)
counts <- as.data.frame(table(species = peng$species))

pie <- vplot(counts) |>
  mark_pie(value = Freq, fill = species) |>
  labs(title = "Pie")

donut <- vplot(counts) |>
  mark_donut(value = Freq, fill = species, hole = 0.6) |>
  labs(title = "Donut")

p <- hconcat(pie, donut)

Back to top