ggwaffle icon indicating copy to clipboard operation
ggwaffle copied to clipboard

Help with displaying country flags

Open rempsyc opened this issue 2 years ago β€’ 0 comments

Hi, thank you for this great package. I am trying to replace the squares by country flags. Here is my current attempt:

library(ggplot2)
library(emojifont)
library(ggwaffle)

iris2 <- iris
iris2$Species <- c("πŸ‡ΊπŸ‡Έ", "πŸ‡¨πŸ‡¦", "πŸ‡¬πŸ‡§")

waffle_data <- waffle_iron(iris2, aes_d(group = Species))
waffle_data$label = fontawesome('fa-flag')

ggplot(waffle_data, aes(x, y, colour = group)) +
  geom_text(aes(label=label), family='fontawesome-webfont', size=7) +
  coord_equal() +
  scale_colour_waffle() +
  theme_waffle()

Created on 2023-06-18 with reprex v2.0.2

Is it possible at all with ggwaffle? I was trying to play with ggflags as well but I don't see how to make these two compatible because ggflags replace points in a scatter plot. Thanks.

Here is my stackoverflow question for reference: https://stackoverflow.com/questions/76501103/how-to-display-country-flags-on-waffle-chart-symbols-using-e-g-ggwaffle

rempsyc avatar Jun 18 '23 14:06 rempsyc