Create Waffle Chart Visualizations in R

Square pie charts (a.k.a. waffle charts) can be used to communicate parts of a whole for categorical quantities. To emulate the percentage view of a pie chart, a 10x10 grid should be used with each square representing 1% of the total. Modern uses of waffle charts do not necessarily adhere to this rule and can be created with a grid of any rectangular shape. Best practices suggest keeping the number of categories small, just as should be done when creating pie charts. Tools are provided to create waffle charts as well as stitch them together, and to use glyphs for making isotype pictograms.

Build Status CRAN_Status_Badge downloads

waffle is a package to make waffle charts (square pie charts)

It uses ggplot2 and returns a ggplot2 object.

The following functions are implemented:

  • waffle : make a waffle chart ggplot2 object
  • iron : vertically stitch together multiple waffle plots, left-aligning edges (best if used with the waffle pad parameter)


# current verison
## [1] '0.7.0'
# basic example
parts <- c(80, 30, 20, 10)
waffle(parts, rows=8)
# slightly more complex example
parts <- c(`Un-breached\nUS Population`=(318-11-79), `Premera`=11, `Anthem`=79)
waffle(parts, rows=8, size=1, colors=c("#969696", "#1879bf", "#009bda"), legend_pos="bottom") 

Health records breaches as fraction of US Population

One square == 1m ppl

waffle(parts/10, rows=3, colors=c("#969696", "#1879bf", "#009bda")) 

Health records breaches as fraction of US Population

(One square == 10m ppl)

waffle(parts/10, rows=3, colors=c("#969696", "#1879bf", "#009bda"),
       use_glyph="medkit", size=8)
# replicating an old favourite
savings <- c(`Mortgage\n($84,911)`=84911, `Auto and\ntuition loans\n($14,414)`=14414, 
             `Home equity loans\n($10,062)`=10062, `Credit Cards\n($8,565)`=8565)
waffle(savings/392, rows=7, size=0.5, legend_pos="bottom",
       colors=c("#c7d4b6", "#a3aabd", "#a0d0de", "#97b5cf"))

Average Household Savings Each Year

(1 square == $392)

# similar to but not exact
professional <- c(`Male`=44, `Female (56%)`=56)
waffle(professional, rows=10, size=0.5, colors=c("#af9139", "#544616"))

Keeps factor by default levels now


  waffle(c(thing1=0, thing2=100), rows=5),  
  waffle(c(thing1=25, thing2=75), rows=5)

Without (you can disable this via keep parameter now):

  waffle(c(thing1=0, thing2=100), rows=5, keep=FALSE),  
  waffle(c(thing1=25, thing2=75), rows=5, keep=FALSE)

Professional Workforce Makeup

Iron example (left-align & padding for multiple plots) <- c(`YOY (406)`=406, `Adult (24)`=24)
A <- waffle(, rows=7, size=0.5, 
            colors=c("#c7d4b6", "#a3aabd"), 
            title="Paine Run Brook Trout Abundance (1997)", 
            xlab="1 square = 2 fish", pad=3) <- c(`YOY (221)`=221, `Adult (143)`=143)
B <- waffle(, rows=7, size=0.5, 
            colors=c("#c7d4b6", "#a3aabd"), 
            title="Piney River Brook Trout Abundance (1997)", 
            xlab="1 square = 2 fish", pad=8) <- c(`YOY (270)`=270, `Adult (197)`=197)
C <- waffle(, rows=7, size=0.5, 
            colors=c("#c7d4b6", "#a3aabd"), 
            title="Staunton River Trout Abundance (1997)", 
            xlab="1 square = 2 fish")
iron(A, B, C)

Test Results

## [1] "Sat Jan  7 08:05:00 2017"
## testthat results ========================================================================================================
## DONE ===================================================================================================================



waffle 0.7.0

  • yet more fixes for latest ggplot2 2.x
  • made factor-level keeping a parameter (TRUE by default)

waffle 0.6.0

  • keep factor levels; improve default aesthetics

waffle 0.5.1

  • even moar improved ggplot2 compatibility

waffle 0.5

  • new & improved ggplot2 compatibility

waffle 0.4

  • added use_glyph() and glyph_size() to waffle() so you can now make isotype pictograms

waffle 0.3

  • added a pad parameter towaffle to make it easier to align plots
  • added `iron to make it easier to do the alignment

waffle 0.2.3

  • nulled many margins and made the use of coord_equal optional via theequal parameter

waffle 0.2.1

  • added Travis tests to ensure independent package build confirmation

waffle 0.2

  • added `as_rcdimple thx to Kent Russell (only in non-CRAN version)

waffle 0.1

  • initial release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.7.0 by Bob Rudis, a year ago

Report a bug at

Browse source code at

Authors: Bob Rudis [aut, cre], Dave Gandy [aut] (Font Awesome)

Documentation:   PDF Manual  

GPL (>= 2) license

Imports RColorBrewer, grid, gridExtra, gtable, extrafont

Depends on ggplot2

Suggests testthat

See at CRAN