Search code examples
rchartswaffle-chart

Remove blank squares from waffle chart


I'm trying to make a waffle chart in R using the waffle package. I don't have an even number of entries (49) and I get blank filler squares in my otherwise perfect chart (see purple/blue squares).

Sample Chart

Here is an example of the code:

library('waffle')
basedata <- c(11,38)
names(basedata) <- c("Awsome", "Not Awsome")
waffle(basedata, rows = 2)

Any idea how to remove the blank filler squares?


Solution

  • waffle(basedata, rows = 2, colors = c("blue", "green", "white"))
    

    or if you want to match the colors to how they were, look up the color scheme at Color Brewer and add the hex codes.

    waffle(basedata, rows = 2, colors = c("#fb8072", "#8dd3c7", "white"))
    

    Also, I assume the word "Awesome" isn't included in the real thing, but in case it is, be sure to add that extra "e" in there. :)