This creates a donut chart, similar to a pie chart.

ggla_donut(
  mapping = NULL,
  data = NULL,
  stat = "count",
  title = NULL,
  gla_theme = "default",
  base_size = 14,
  ...
)

Arguments

mapping

Set of aesthetic mappings created by aes() or aes_(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

The data to be displayed in this layer. There are three options:

If NULL, the default, the data is inherited from the plot data as specified in the call to ggplot().

A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See fortify() for which variables will be created.

A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).

stat

The statistical transformation to use on the data for this layer, as a string. Should be either 'count', for the number of cases in each group, or 'identity' to represent values in the data. Default: 'count'

title

String title to be used for plot. Will appear in the middle of the donut, Default: NULL

gla_theme

Either "default" or "inverse", Default: 'default'

base_size

base font size, Default: 14

...

Other arguments to be passed on to geom_bar()

Details

This works by creating a stacked bar chart and converting to polar coordinates.

Aesthetics

ggla_donut() understands the following aesthetics (required aesthetics in bold).

  • y

  • label (will appear outside the donut)

  • alpha

  • colour

  • fill

  • group

  • shape

  • size

  • stroke

See also

Examples

if (FALSE) { if(interactive()){ #EXAMPLE1 } }