Skip to contents

Simple donut chart (to be used parsimoniously), can be a pie chart

Usage

donut(
  df,
  x,
  y,
  alpha = 1,
  x_title = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  arrange = TRUE,
  hole_size = 3,
  add_text = TRUE,
  add_text_treshold_display = 5,
  add_text_color = "white",
  add_text_suffix = "",
  theme = theme_reach(legend_reverse = TRUE)
)

Arguments

df

A data frame.

x

A character column or coercible as a character column. Will give the donut's fill color.

y

A numeric column.

alpha

Fill transparency.

x_title

The x scale title. Default to NULL.

title

Plot title. Default to NULL.

subtitle

Plot subtitle. Default to NULL.

caption

Plot caption. Default to NULL.

arrange

TRUE or FALSE. Arrange by highest percentage first.

hole_size

Hole size. Default to 3. If less than 2, back to a pie chart.

add_text

TRUE or FALSE. Add the value as text.

add_text_treshold_display

Minimum value to add the text label.

add_text_color

Text color.

add_text_suffix

If percent is FALSE, should we add a suffix to the text label?

theme

Whatever theme. Default to theme_reach().

Value

A donut chart to be used parsimoniously