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.

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)

  • Version 0.6.0 - keep factor levels; improve default aesthetics

  • Version 0.5.1 released - even moar improved ggplot2 compatibility

  • Version 0.5 released - new & improved ggplot2 compatibility

  • Version 0.4 released - added use_glyph and glyph_size to waffle so you can now make isotype pictograms

  • Version 0.3 released - added a pad parameter to waffle to make it easier to align plots; added iron to make it easier to do the alignment

  • Version 0.2.3 released - nulled many margins and made the use of coord_equal optional via the equal parameter

  • Version 0.2.1 released - added Travis tests to ensure independent package build confirmation

  • Version 0.2 released - added as_rcdimple thx to Kent Russell (only in non-CRAN version)

  • Version 0.1 released

# current verison
## [1] '0.6.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")) +

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, 
       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"))
  waffle(c(thing1=0, thing2=100), rows=5),  
  waffle(c(thing1=25, thing2=75), rows=5)

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)

## [1] "Sun Sep 18 10:40:27 2016"
## testthat results ========================================================================================================
## DONE ===================================================================================================================


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