I'm trying to create a facet_wrap plot that compares four separate lines to a common fifth line; the goal is to have this fifth line appearing on all four of the other facet_wrap plots.
Here's my minimal code:
library(ggplot2)
x = c( 1, 3, 1, 3, 2, 4, 2, 4)
y = c( 1, 3, 2, 4, 1, 3, 2, 4)
type = c("A","A","B","B","C","C","D","D")
data = data.frame(x,y,type)
x = c( 4, 1)
y = c( 1, 4)
type = c("E","E")
line = data.frame(x,y,type)
ggplot(data, aes(x,y)) + geom_line() + facet_wrap(~type) +
geom_line(data = line, aes(x,y))
I was hoping that adding the fifth line as an independent data.frame would allow me to do this, but it just adds it as a fifth facet, as in the following image:

I want the "E" facet to show up on all of the other plots. Any thoughts? I know that geom_vline, geom_hline, and geom_abline will all appear on all of the facets, but I'm not sure what makes them unique.

You have specified
type='E'in yourlinedata.frame. If you want to have this line on typeA,B,C,D, then create adata.framewith the types on which you want the line to displayYou could also use
annotate, which means you don't specify a data.frame, but pass the x and y values directlyBoth create