Learn R Programming

g2r (version 0.1.0)

fig_waffle: Waffle

Description

Create a waffle plot based on x, y, and optionally color aspects.

Usage

fig_waffle(g2, ..., rows = 10, count = 500, waffle_size = list(1, 1),
  gap_ratio = 0.1, data = NULL, inherit_asp = TRUE, name = NULL)

Arguments

g2

An object of class g2r as returned by g2r.

...

Any option, aesthetic (asp), or animation (Animation).

rows

Number of rows.

count

Number of squares to use.

waffle_size

Size of squares.

gap_ratio

Gap between squares.

data

A data.frame containing data to chart or a list.

inherit_asp

Whether to inherit aspects from g2r.

name

Name of figure, useful to apply functions to specific figures.

Examples

Run this code
# NOT RUN {
fruits %>% 
  dplyr::mutate(value = value * 100) %>% 
  g2(asp(fruit, value)) %>% 
 fig_waffle(asp(color = fruit))

# }

Run the code above in your browser using DataLab