You have specified type='E'
in your line
data.frame. If you want to have this line on type A,B,C,D
, then create a data.frame
with the types on which you want the line to display
xl = c( 4, 1)
yl = c( 1, 4)
type =rep(LETTERS[1:4], each=2)
line2 = data.frame(x=xl,y=yl,type)
ggplot(data, aes(x,y)) + geom_line() + facet_wrap(~type) +
geom_line(data = line2)
You could also use annotate
, which means you don't specify a data.frame, but pass the x and y values directly
ggplot(data, aes(x,y)) + geom_line() + facet_wrap(~type) +
annotate(geom='line', x=xl,y=yl)
Both create