The function uses ggplot2 to create waffle charts from data.

waffle_chart(
  data,
  fill,
  value = "value",
  facet = NULL,
  composition = TRUE,
  max_value = NULL,
  digits = 3,
  fill_colors = NULL,
  fill_title = NULL,
  ncol = NULL,
  base_size = 12,
  line_size = LS(1),
  legend.position = "bottom"
)

Arguments

data

data frame to be plotted

fill

character specifying the column name which should be used as fill for the waffle plot.

value

character specifying the column name which contains values of the fill variable. Will be used to fill the waffle cells.

facet

character specifying the column name which should be used to facet_wrap waffle charts.

composition

logical indicating whether a compositional waffle (i.e. fill adds up to 100%) should be created. If FALSE, waffle cells will be scaled to max_value and missing cells filled with an "empty" category.

max_value

numerical giving the value to which waffle cells should be scaled to, if composition = FALSE.

digits

integer indicating the number of decimal places to be used in rounding of the waffle cells. The value 3 indicates percentages, while 4 permilles.

fill_colors

named character vector giving the colors for fill levels. See scale_fill_manual.

fill_title

character giving the title for the color legend.

ncol

number of columns to be used in facetting. See facet_wrap.

base_size

numeric giving the base size for the plot. See theme_void.

line_size

numeric value giving the size of lines between waffles cells.

legend.position

character specifying the position of the legend. See ggtheme.

Value

Returns a ggplot2 waffle plot

Details

The waffle charts are read from left to right (like text) and from bottom upwards (like water glass). The cells indicate 1% of the maximum value (100

See also

Other waffle: round_preserve_sum(), waffleize()