Here is the data:
df <- structure(list(country = c("Australia", "Australia", "Australia",
"South Korea", "South Korea", "South Korea"), parts = c("case_1",
"case_2", "non_case", "case_1", "case_2", "non_case"), values = c(1,
19, 80, 1, 29, 70)), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"))
library(tidyverse)
library(waffle)
df %>% ggplot(aes(label = parts, values = values)) +
geom_pictogram(n_rows = 10, aes(color = parts),
family = 'fontawesome-webfont',
flip = TRUE,
size = 6,
show.legend = FALSE,
make_proportional = TRUE
) +
scale_label_pictogram(
name = "Confirmed cases",
values = c("male"),
) +
coord_equal() +theme_minimal() +
facet_wrap(~country, nrow = 2, strip.position = "top")
In the above code, I generated the following waffle chart. With make_proportional = TRUE
and n_rows = 10
, I expected to get 100 icons for each country, but instead got 99 for South Korea. Only way that I can fix this problem is to calculate all proportions first and using make_proportional = FALSE
, but it will take some time. Also, I feel this is a little bit strange. It would be appreciated if anyone could help me with this.