Pass in a a variable and get a waffle plot. Useful to display simple counts or if the variable has different values, a square pie chart. If the variable has a length that makes the individual squares hard to see, consider showing hundreds, thousands etc.
qplot_waffle(x, shape = 15, rows = NULL, cols = NULL, drop_shadow_h = -0.3, drop_shadow_v = 0.3)
x | a variable with not too many unique values |
---|---|
shape | defaults to a filled square |
rows | defaults to the rounded up square root of the number of values |
cols | defaults to the rounded down square root of the number of values |
drop_shadow_h | horizontal offset of the drop shadow, tinker with this to get a proper shadow effect |
drop_shadow_v | vertical offset of the drop shadow |
To avoid the Hermann grid illusion, don't use dark colours.
qplot_waffle(rep(1:2,each=200))#> Warning: Ignoring unknown parameters: show_legend#> Warning: Ignoring unknown parameters: show_legend