I am trying to label columns with geom_text() on a geom_col() however, the labels (numbers) are not printing out correctly, nor positioning the way I would like them to. vjust does not seem to be working as I wanted the labels to be at the top of the columns (inside them) but they remained at the bottom. The columns should show the total distance ridden by rider type but they are not even readable.
Attached a screenshot on the output of my code below. Hope it's not a duplicate question and really appreciate any help you can give me as I am new to R and I am a little bit stuck with this one.
total_distance_ridden_by_rider_type <-
ggplot(consolidated_data_202106_202205, aes(member_casual, distance))+
geom_col(aes(fill = member_casual))+
labs(y = "Distance ridden in km",
x = "Rider type",
title = "Distance ridden by Rider type in km",
subtitle = "Over the period of 2021-06-01 - 2022-05-31",
fill = "Rider type")+
scale_y_continuous(labels = unit_format(unit = "M", scale = 1e-6))+
geom_text(aes(x = member_casual, y = distance, label = comma(distance)),
stat = "identity",
vjust = 1.5,
colour = "black",
size = 5)+
theme(legend.position = "top",
plot.title = element_text(size = 20),
plot.subtitle = element_text(size = 15))