another way to handle sizing of glyphs | get interactivity
For anyone that wants the graphic to be responsive or potentially interactive, I thought it might be helpful to demo this little bit of code. Resize the browser or viewer to see the effect.
library(waffle)
library(extrafont)
library(gridSVG)
library(XML)
library(htmltools)
library(pipeR)
# slightly more complex example
parts <- c(`Un-breached\nUS Population`=(318-11-79), `Premera`=11, `Anthem`=79)
library(extrafont)
waffle(parts/10, rows=3, colors=c("#969696", "#1879bf", "#009bda"),
use_glyph="medkit", size=8)
grid.export(name=NULL) %>>%
(.$svg) %>>%
(~{xmlAttrs(.)["width"]="100%"} ) %>>%
(~{xmlAttrs(.)["height"]="100%"} ) %>>%
saveXML %>>%
HTML %>>%
html_print