i am doing a data science module at Uni, and am relatively new at R. I am having trouble with adding data values to my stacked chart, and have no clue on how to fix it.
My current code is this:
bp <- ggplot(race_death) +
geom_bar(aes(x = Race, fill = Died)) +
ggthemes::theme_economist()+
scale_fill_manual(values = my_palette)+
geom_label(aes(x = Race, y = n ,label = n), size = 3, position = position_stack(vjust = 0.5, reverse = FALSE), Deaths) bp +
coord_flip()
But the graph shows this:
The numbers are correct, but they are in the wrong places, e.g. 454 should be in the middle of the green bar, instead of in the orange. How do i go about fixing this?