3

When you have values <1 in a waffle plot they won't display.

library(waffle)
wp<-waffle(c(10,25,25,1,0.05,0.5,30,7.5,0.95),
           rows=10,
           colors=c("#CC0000", "#006600", "#669999", "#00CCCC", 
                    "#660099", "#CC0066", "#FF9999", "#FF9900", "black"))

enter image description here

Is there a way using waffle or ggplot to fill in the remaining boxes with their proportional value? e.g. multiple colours per cell ?

2
  • 1
    The purpose of a waffle plot is that it shows 1 square or icon per observation. Trying to split squares kind of defeats that purpose. That said, depending on the context, it might make sense to scale your data somehow Commented Jun 15, 2018 at 17:59
  • @camille scaling is certainly possible, however I am interested in an approach that could potentially divide up one square with multiple values for those <1% Commented Jun 16, 2018 at 14:14

1 Answer 1

3

That is kind of the point. As @camille said, it is kind of the point of a waffle plot to have 1 element per full observation.

What you (or anyone else wanting a similar result) could do, however, is to reshape the data slightly to reflect those small observations in their own "Others" category:

parts <- c("A" = 10, "B" = 25, "C" = 25, "D" = 1, "G" = 30, "H" = 7.5, 
       "Others" = 0.95 + 0.05 + 0.5)
waffle(parts,
       rows=10,
       colors=c("#CC0000", "#006600", "#669999", "#00CCCC", 
                "#FF9999", "#FF9900", "blue"))

Result plot

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.