gg_pie: A tasteful pie chart

View source: R/gg_pie.R

gg_pieR Documentation

A tasteful pie chart

Description

Sometimes you gotta make a pie chart. And if you do, it should make some efforts to hellp it to convey information clearly. Some critics say that pie charts should never be used because the area representations (i.e. pie slices) are difficuly for humans to make sense of. I agree and I disagree. I avoid them as much as I can with my own data viz, bar charts seem to work better to me. But sometimes you have a collaborator who really wants a pie chart, and you want to be a team player. Also, with less than 4 groups, I think that they do just fine. Thought that should come witha couple of caveats: (1) if the pie slices are really small then it becomes really difficult to tell what value they represent, and (2) if mulitple pie slices are close in size the it becomes difficult to tell them apart.

Usage

gg_pie(data, var, over_ride = FALSE, ...)

Arguments

data

A data frame or tibble

var

Variable with the data to be sliced

over_ride

Logical; The function won't let you plot more than 4 groups when 'over_ride = FALSE'.

...

Additional function arguments

Examples

## Not run: 
gg_pie(data = ggplot2::mpg, var = class)
gg_pie(data = ggplot2::mpg, var = class, over_ride = TRUE)
gg_pie(data = ggplot2::diamonds, var = clarity)
gg_pie(data = ggplot2::diamonds, var = clarity, over_ride = TRUE)

## End(Not run)

emilelatour/laviz documentation built on Nov. 11, 2024, 9:42 p.m.