I am making a boxplot where each categorical variable on the x-axis has 2 corresponding box plots (side-by-side). I am trying to label the median bar, but the labels come out stacked rather than side by side -- image below for reference.
How can I move the top label to the left and the bottom label to the right along the x-axis? My code is below, I've tried a wide variety of position nudges and v values with no success.
ggplot() +
geom_boxplot(data = data, aes(x = cat_var, y = value, fill=status), alpha = 0.3) +
scale_y_log10() +
facet_wrap(~cat_var2) +
scale_fill_manual(values=cat.colors) +
geom_text(data = labs2, aes(x = cat_var, y = med, label = med), position =
position_nudge(x=0.05, y=.05))