Description Usage Arguments Note Examples
Given a named vector, this function will return a ggplot object that represents a waffle chart of the values. The individual values will be summed up and each that will be the total number of squares in the grid.
1 2 3 |
parts |
named vector of values to use for the chart |
rows |
number of rows of blocks |
xlab |
text for below the chart. Highly suggested this be used to give the "1 sq == xyz" relationship if it's not obvious |
title |
chart title |
colors |
exactly the number of colors as values in |
size |
width of the separator between blocks (defaults to |
legend_pos |
position of legend |
flip |
flips x & y axes |
reverse |
reverses the order of the data |
equal |
by default, waffle uses |
pad |
how many blocks to right-pad the grid with |
use_glyph |
use specified FontAwesome glyph |
glyph_size |
size of the FontAwesome font |
If the vector is not named or only partially named, capital letters will be
used instead. If you specify a string (vs FALSE
) to use_glyph
the function
will map the input to a FontAwesome glyph name and use that
glyph for the tile instead of a block (making it more like an isotype pictogram than a
waffle chart). You'll need to actually install FontAwesome and use
the extrafont
package (https://github.com/wch/extrafont
) to
be able to use the FontAwesome glyphs.
1 2 3 4 5 | tiles <- c(One=80, Two=30, Three=20, Four=10)
Waffleplot(tiles, rows=8)
Senate <- c(`Male (44%)`=44, `Female (56%)`=56)
Waffleplot(Senate, rows=10, size=0.5, colors=c("#af9139", "#544616"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.