如何唯一地注释每个主要方面,但在相应的边距方面没有注释?以下代码将文本放置在我想要的主要方面,但边距显示叠加的文本。如何抑制边距构面中的文本?
frame_labels <- data.frame(
frame = LETTERS[1:4],
vs = rep(0:1, each = 2),
am = rep(0:1, times = 2),
x = 5, y = 33)
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point()
p <- p + facet_grid(vs ~ am, margin = TRUE, as.table = FALSE)
p <- p + geom_text(data = frame_labels, aes(x = x, y = y, label = frame))
print(p)