Apologies if this question is trivial, I've created a side geom_bar
plot and I'm just trying to figure out how I can adjust the positioning of the percentage labels. I would like to have each label either just outside each sidebar, or just inside (but not overlapping inside and outside like in the image below)
Here is my dataset bars
structure(list(date = structure(c(18577, 18577, 18577, 18577,
18577, 18577, 18577, 18577, 18577, 18577), class = "Date"), Ticker = c("ARS",
"BRL", "IDR", "INR", "MXN", "NGN", "RUB", "THB", "TRY", "ZAR"
), Return = c(-7.1, 2.1, 3.5, -0.8, 7.3, 1.3, -3.3, 2.5, -10.5,
8)), row.names = c(NA, -10L), class = c("tbl_df", "tbl", "data.frame"
))
and my code below
p1 <- ggplot(bars, aes(Ticker,Return,fill=Ticker)) +
geom_bar(stat='identity') +
coord_flip() +
theme(legend.position = 'bottom') +
labs(title = '% Change in EM Currencies vs USD since September 1',
subtitle = 'Performance of EM Currencies has diverged recently',
y = '% Change since September 1', x = '') +
geom_hline(yintercept = 0,linetype = 'dashed',
col = 'black',size = 1) +
geom_text(aes(label=paste0(Return,"%")))
p1