I can't for the life of me figure out what's going on here. Here's the code:
full_c_df |>
ggplot() +
aes(
x = year_month,
y = conversions,
fill = series
) +
geom_bar(stat = "identity", position = "dodge") +
geom_text_repel(
aes(label = round(conversions, digits = 0)),
family = "barlow",
angle = 45,
position = position_dodge(1),
stat = "identity", box.padding = 1
) +
labs(
title = "Estimated Traffic to Bottom of XXX, 2022 Actuals and Forecast",
caption = paste0(
"Data sourced from XXX Excludes XXX traffic. Attribution type is ",
attribution,
" touch. Last date of actual data is ",
last_date,
"."
),
x = "Month of Year",
y = "conversions",
subtitle = paste0("Analysis by TrustInsights.ai for week of ", today, ".")
) +
scale_fill_manual(values = c("palegreen4", "tomato3", "lightblue")) +
annotation_custom(rast) +
theme_light(base_size = 14, base_family = "barlow")
And here's what it generates.
The goal is to get each label centered on the appropriate bar. What am I doing wrong? I've been unable to get this right either with stock geom_text or with ggrepel's geom_text_repel.