I have a data frame that looks like this:
df = data.frame(
comp_id= c("1A","1A","1A"),
rate = c(93,93,93),
quartile = c("25 pctl","50","75 pctl"),
quartile.value = c(88,92,95)
)
It graphs a point against quartiles. For some reason, I cannot remove the gap between the bar and the left axis.
-Setting cartesian doesn't work, and adding expand(0,0) to scale_y_continuous also doesn't work
library(scales)
ggplot(df,
aes(x = comp_id)) +
geom_col(aes(y = quartile.value, fill = quartile),
position = position_dodge(0), width = 2.5) + scale_color_manual(values=c("black"),labels=c("comp_id")) +
geom_point(aes(y = rate, color="comp_id"), size=3, shape=20) +
scale_fill_manual(values = c("azure2", "azure3", "azure4"), labels=c("25th Pctl","Median","75th Pctl")) +
labs(x="", y="") + scale_y_continuous(limits=c(80,100), oob=rescale_none) + theme(panel.border = element_blank(), panel.background=element_blank()) +
theme(legend.title=element_blank()) + theme(legend.position="bottom") + scale_x_discrete(expand=c(0,0))
Edit: I used the scales package because the bars disappeared when I specified the limits on the y axis.