我有两张图,我需要用两种不同的颜色覆盖它们。
a <- matrix(c(0,0,1,0,1,1,0,1), ncol = 2 ,byrow = T)
b <- .5*matrix(c(0,0,1,0,1,1), ncol = 2 ,byrow = T)
p1 <- ggplot()
p1 <- p1 + geom_polygon(data = data.frame(a), aes(a[,1], a[,2]), fill = NA, col = "black")
p2 <- ggplot()
p2 <- p2 + geom_polygon(data = data.frame(b), aes(b[,1], b[,2]), fill = NA, col = "red")
p2