Hello. I have created the following waffle chart using ggplot:
library(tidyverse)
library(waffle)
graf3 <- data.frame(
tamaño = c("Micro","Pequeño", "Mediano", "Grande"),
porcentaje = c(42,13,37,8),
stringsAsFactors = FALSE)
ggplot(data = graf3,
aes(fill = tamaño, values = porcentaje)) +
geom_waffle(n_rows = 10, size = 1, flip = TRUE, color="white") +
coord_equal() +
theme_minimal() +
theme_enhance_waffle() +
scale_fill_brewer(palette = "Set2")
I want to insert the text of the variable "porcentaje" into the graph. I have tried to do so but it has produced very ugly results:
ggplot(data = graf3,
aes(fill = tamaño, values = porcentaje)) +
geom_text(aes(x=tamaño, y=porcentaje, label=porcentaje)) +
geom_waffle(n_rows = 10, size = 1, flip = TRUE, color="white") +
coord_equal() +
theme_minimal() +
theme_enhance_waffle() +
scale_fill_brewer(palette = "Set2")
I would be very thankful for any advice on how to solve the issue.