hrbrmstr/waffle

Attempting to create waffle chart with non-integers

amr262 opened this issue · 0 comments

Hello,
I'm attempting to create a one-row waffle chart with an Awesome Font character. Essentially, I'm looking to create 10 characters, each of which represents 10% of my sample. I would like to display the fact that 65% of my sample agrees w/ a survey question.

Rather than create a waffle chart w/ 100 characters, 65 of which are the color representing agree (black), I want to create a chart with 10 character, 6.5 of which are black and 3.5 in the color representing disagree (grey). Ideally, I would like the first 6 characters to be black, the 7th character to be half black and half grey, and characters 8-10 to be grey.

Right now, when I enter in 6.5 as my first element and 3.5 as my second element, the package rounds up the first element, so I see 7 black characters and 3 grey characters. I also get a warning message, which I suspect is due to the non-integers.

I've included the code, the image, and warning message below. Is there any way to proportionally fill characters with colors?

Thanks!

waffle(c("Male" = 6.5, "Female" =3.5),

  • rows = 1, use_glyph = "male", glyph_size = 8, colors = c("#000000","#CCCCCC"),
  • xlab = "1 person = 10%", legend_pos = "none", pad = 0)
    Warning message:
    Removed 1 rows containing missing values (geom_text).

agree waffle