Created a Bar Graph where each bar has a percentage label affixed. I'd like to change the angle of the text to make it easier to read. Months are aligned along the x axis and the sum of transacyions for each month are aligned along y, with a user type separating each month into two separate bars. the labels on the bars themselves are a separate percentage field to help clarify the proportion of each user type contained in the month.
Chart_2022 <- Breakdown_2022 %>% ggplot(mapping = aes(x = Month,
y = monthly_transactions, fill = Rider_Class)) + geom_col(position = "dodge") +
geom_text(aes(label = prop), position = position_dodge(width = 1),
vjust = -0.25) + scale_y_continuous(labels = label_number(suffix = "k",
scale = 0.001))
#> Error in Breakdown_2022 %>% ggplot(mapping = aes(x = Month, y = monthly_transactions, : could not find function "%>%"
Created on 2023-02-27 with reprex v2.0.2
I've looked in the syntax of geom_text() and theme() and i can't seem to find the right statement to adjust it. I've also looked in geom_label to attempt more clarity but the labels are too crowded to work. I've also looked into changing the size but can't find the right adjustment.
UPDATE: Adjusting the element angle in theme() resulted in other elements being affected, but not the labels on the bars themselves
the code used was:
theme(axis.text = element_text(angle = 45))