निम्न लिंक Aligning two plots with ggplot2 से एक क्यू लेते हुए, मैं एक सामान्य एक्स अक्ष के विरुद्ध पहचाने गए 2 "वाई" चर को प्लॉट करने में सक्षम था। मैं अब क्या करना चाहता हूं वह एक geom_point परत को केवल एक पहलू में जोड़ने में सक्षम होना है। यह परत डी 1 के समान संरचना के साथ एक अलग डेटासेट (डी 3) का उपयोग करती है। जब मैं परत जोड़ता हूं तो यह दोनों पहलुओं पर उपयोग किया जाता है। क्या अंक केवल ऊपरी पहलू को लेना संभव है।एक पहलू साजिश में एक पैनल के लिए एक भू-परत जोड़ें
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
+1, एक पुनरुत्पादित उदाहरण –