I'm a beginner to R. I'd like error bars (geom_errorbarh) to be shown on a plot even if they exceed the x-axis limit. Perhaps with some indicator that they're continuing off the plot like an arrow? I don't want to extend the x axis limit for a handful of outlier error bars as most of the plot will then be squashed down into the left side.
data<-data.frame(index=c(1,2,3,1,2,3),
estimate=c("Network Estimate", "Indirect Estimate", "Direct Estimate",
"Network Estimate", "Indirect Estimate", "Direct Estimate"),
RR=c(1.15,2.2,1.12,1.84,1.21,2.73),
ci_l=c(0.5,0.98,0.64,0.87,0.36,1.11),
ci_u=c(2.44,12.09,1.97,1.9,2.8,11.72),
Comparison=c("Example 2", "Example 2", "Example 2",
"Example 1", "Example 1", "Example 1"))
xname<-"Relative Risk"
p <- ggplot(data, aes(y=index, x=RR, xmin=ci_l, xmax=ci_u))+
geom_point()+
geom_point(data=subset(data, Comparison=="All"), color="Black", size=2)+
geom_errorbarh(height=.1)+
scale_x_continuous(limits=c(0,3.5), breaks = c(0:3), name=xname)+
scale_y_continuous(name = "", breaks=1:6, labels =data$estimate)+
geom_vline(xintercept=1, color="black", linetype="dashed", alpha=.5)+
facet_grid(Comparison~., scales= "free", space="free") +
theme_grey()+
theme(text=element_text(family="Times",size=14, color="black"))+
theme(panel.spacing = unit(1, "lines"))+
theme(strip.text.y = element_text(angle=0))
p