I am trying to add labels above (for positive values)/below (for negative values) of the bars in a ggplot bar plot. But, the parameter 'vjust' seems to not be working properly.
I am using a code similar to this:
geom_text(aes_string(y=yCol,label=Labels), hjust=Data$BarLabJustX,vjust=Data$BarLabJustY,na.rm=T)
In my data.frame 'Data', I set BarLabJustX='middle', BarLabJustY='top' for posotive data and BarLabJustY='bottom' for negative data. It seems working on some graphs, and not on others.
Here are a couple of examples:
UPDATE: I found out this problem could be fixed by using the 'BarLabJustY' column inside the mapping (as they are introduced inside the source data.frame):
geom_text(aes_string(y=yCol,label=Labels,hjust='BarLabJustX',vjust='BarLabJustY'),na.rm=T)
I still don't know why this changes the way the code behaves.