0

I'm trying to set up of each bar, it would be interesting to have the count of each color as well (but that isn't the bullseye here). Also, I couldnt even dodge the count to it respective fill

ggplot(my_dataset, aes(x = , fill = )) +
  stat_count() +
  scale_fill_viridis_d(option = "viridis", 
                       direction = 1) +
  labs(x = "Município", y = "Contagem", title = "Histogram with flipped coordinates") +
  coord_flip() +
  theme_minimal() +
  facet_wrap(vars(RTDT)) +
  geom_text(stat = 'count', aes(label = ..count..))

I had to censure my image because these are sensible information of my organization.

Histogram with flipped coordinates

Phil
  • 7,287
  • 3
  • 36
  • 66
  • If you display the cumsum instead of the sum it will work – Yacine Hajji Aug 16 '22 at 13:31
  • Welcome to SO! For positioning the labels for each color, maybe some ideas here can help: https://stackoverflow.com/a/52434835/8400969 For getting the cumulative sum (cumsum) I think you can simply ignore the fill aesthetic in the `geom_text()` with `inherit.aes = FALSE` and then adding in the aesthetics you need. – Michael Roswell Aug 16 '22 at 19:05

0 Answers0