create_pie takes output from one of the covidCluster::*_table functions and produces a pie chart.

plot_pie(
  .table,
  .by = NULL,
  highlight = NULL,
  incl_missing = FALSE,
  title = NULL,
  legend_title = title,
  palette = c("blue", "red", "pink", "purple", "deep-purple", "indigo", "light-blue",
    "cyan", "teal", "green", "light-green", "lime", "yellow", "amber", "orange",
    "deep-orange", "brown", "grey", "blue-grey"),
  legend = FALSE,
  bottom_legend = TRUE,
  background = "gray93",
  dodge = 0
)

Arguments

.table

The output of create_table, which is a one-way tabyl encoded to assist visualization

.by

The variable to chart; defaults to the first column of .table

highlight

A character vector specifying names of categories to highlight; if provided, these will be colored using palette and the remaining categories will be gray

incl_missing

Should the chart include missing values as a category?

title

The title of the chart; defaults to a title-case version of the variable name

legend_title

The title of the chart legend if legend = TRUE; defaults to the chart title. This is ignored if legend = FALSE

palette

The color palette to use; this is a material design color palette generated by pal_material; see that function for details and available choices

legend

Should the chart have a legend?

bottom_legend

Should the legend be positioned at the bottom or on the right side?

background

What should the background color be? Defaults to a light gray.

dodge

Change the position of the labels along the radius of the circle; useful for separating overlapping labels. A value of 0 leaves the labels at the mid-point of the pie chart radius; a value of 1 spaces them evenly across the radius. Values in-between 0 and 1 spread the labels out across that fraction of the radius (centered on the midpoint).

Value

A ggplot object