首先,我会说我刚学ggplot2
,这是我从别人那里继承代码。 我使用facet_wrap
创建并排两个图的一面。 然后我用geom_path
绘制在每个图的形状,但我想在每一个不同的形状。 现在,我只能得到每个图形相同的形状,或在这两个图表两个形状。 所以基本上需要做些什么来一个方面而不是其他。
这是我截的代码:
#variables already defined
square1 <- data.frame(x=c(left, right, right, left, left),
y=c(bottom, bottom, top, top, bottom))
square2 <- data.frame(x=c(left2, right2, right2, left2, left2),
y=c(bottom2, bottom2, top2, top2, bottom2))
RE <- ggplot(data, aes(x, y))
RE <- RE + geom_point()
RE <- RE + xlab + ylab + ggtitle
RE <- RE + coord_cartesian()
RE <- RE + scale_colour_brewer()
RE <- RE + theme_bw()
RE <- RE + facet_wrap(~ v1 + v2, ncol=2)
RE <- RE + geom_path(aes(x = x, y = y), data = square1) + geom_path(aes(x = x, y = y), data = square2, linetype = 2)