Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Make waffle charts with ggplots

$
0
0

I am trying to reproduce a simple waffle graph like this from Tableau with R: enter image description here

I'm not sure if is doable in waffle package, however I would really appreciate any help on two cases:

  • Is there any way to color fill the waffle chart row-wise (like Tableau example) not column-wise?
  • Is it possible to add label percent (24%) to the Waffle chart?

Here is my try so far :

 library(waffle)  

 # dummy sample 
 basedata <- c('User'=24, 'Not User'=  76)

 # Waffle chart
 waffle(
   basedata,
   rows = 10 ,
   colors =  c("#636363", "#fee8c8"),
   xlab = "1 square == 1%"
 ) +
   ggtitle("Some tilte") +
   theme(
     plot.title = element_text(hjust = 0.5, size = 27, face = "bold"),
     legend.text = element_text(size = 15),
     legend.position = "bottom"
   )

Which will return this enter image description here


Viewing all articles
Browse latest Browse all 201839

Trending Articles