I was following code from this post but it is not working the same for me. Here's my code and screenshot below. Can you help me center the label with spacing just above the bar?
p <- ggplot(data=mrc, aes(x = Year, y = Total, fill = Year)) +
geom_bar(stat="identity", position = "dodge") +
geom_text(
aes(x = Year, y = Total, label = Total),
position = position_dodge(width = 1),
vjust = -0.5, size = 3
) +
theme_bw() +
scale_fill_manual(values = c("#115740","#B9975B","#D0D3D4","#F0B323")) +
theme(axis.title.x=element_blank(),
axis.title.y=element_blank(),
legend.position = "none",
plot.title = element_text(hjust = 0.5, face = "bold", colour = "#B9975B")) +
ggtitle("Petitions")
ggplotly(p)
mrc
) to make it reproducible – Tunggeom_col()
instead ofgeom_bar(stat="identity", position = "dodge")
and omitting theposition =
argument togeom_text
. – neilfws