How can I set inward facing bar labels in a bar chart with positive and negative values in ggplot2? I.e. the bar labels should be facing the 0 axis.
df <- data.frame(trt = c("a", "b", "c", "d"),
outcome = c(2.3, 1.9, 0.5, -0.5))
ggplot(df, aes(trt, outcome, label = outcome)) +
geom_bar(stat = "identity",
position = "identity") +
geom_text(vjust = "inward", color = 'red')
vjust = "inward" is obviously not the way to go, since "Inward and outward are relative to the physical middle of the plot, not where the 0 axes are".
Update:



geom_text(vjust=c(1, 1, 1, 0), nudge_y=c(-0.1, -0.1, -0.1, 0.4), color = 'red')something like you're after? - hrbrmstrnudge_yvalues, but that's just optics). My main concern is, however, that I want to make many graphs like this and I would have to adjust each graph by hand depending on the values of the variables. So overall, not quite. - dpprdan