Taking a cue from the following link Aligning two plots with ggplot2, I was able to plot 2 "y" variables faceted against a common x axis. What I want to do now is to be able to add a geom_point layer to only one of the facets. This layer uses a different dataset(d3) with a same structure as d1. When I add the layer it gets used on both facets. Is it possible to layer the points only the upper facet.
library(ggplot2)
x <- seq(1992, 2002, by = 2)
d1 <- data.frame(x = x, y = rnorm(length(x)))
xy <- expand.grid(x = x, y = x)
d2 <- data.frame(x = xy$x, y = xy$y, z = jitter(xy$x + xy$y))
d3 <- data.frame(x = x, y = 3+rnorm(length(x)))
d1$panel <- "a"
d2$panel <- "b"
d1$z <- d1$x
d <- rbind(d1, d2)
p <- ggplot(data = d, mapping = aes(x = x, y = y))
p <- p + facet_grid(panel ~ ., scale = "free")
p <- p + layer(data = d1, geom = c( "line"), stat = "identity")
###*p <- p + layer(data = d3, geom = c( "point"))* - This is the layer I intend to add only to the top panel
p <- p + layer(data = d2, geom = "line", stat = "identity")
p