1

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 ?

Community
  • 1
  • 1
GISHuman
  • 1,026
  • 1
  • 8
  • 27
  • 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 – camille Jun 15 '18 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% – GISHuman Jun 16 '18 at 14:14

1 Answers1

2

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

Roman
  • 4,744
  • 2
  • 16
  • 58