Skip to contents

Simple waffle chart

Usage

waffle(
  df,
  x,
  y,
  n_rows = 10,
  size = 2,
  x_title = NULL,
  x_lab = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  arrange = TRUE,
  theme = theme_reach(axis_x = FALSE, axis_y = FALSE, legend_position = "bottom",
    legend_direction = "horizontal", title_hjust = 0.5)
)

Arguments

df

A data frame.

x

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

y

A numeric column (if plotting proportion, make sure to have percentages between 0 and 100 and not 0 and 1).

n_rows

Number of rows. Default to 10.

size

Width of the separator between blocks (defaults to 2).

x_title

The x scale title. Default to NULL.

x_lab

The x scale caption. 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.

theme

Whatever theme. Default to theme_reach().

Value

A waffle chart