I am following this answer as a guide, but the labels are appearing in the wrong place. Does anyone know what might be causing this?
library(ggplot2)
Macrorregião <- c("Norte", "Nordeste", "Sudeste", "Sul", "Centro-Oeste")
Destino <- c("Despesa", "Água", "Esgoto", "Outros")
Valor <- 1:20
DF <- expand.grid(Destino = Destino,
Macrorregião = Macrorregião)
DF$Valor <- Valor
ggplot(data = DF,
aes(x = Macrorregião,
y = Valor)) +
geom_col(aes(fill = Destino)) +
geom_text(aes(label = Valor),
position = position_stack(vjust = 0.5))