下面的代码就像一个魅力:
foo = data.frame(x=c(1,2,3),
y=c(4,5,6),
lt=c('dotted', 'dashed', 'dotdash'))
ggplot(foo, aes(x,y)) + geom_point() +
geom_vline(aes(xintercept=x, linetype=lt))
以下代码删除线型。为什么?
ggplot(foo, aes(x,y)) + geom_point() +
geom_vline(xintercept=3, aes(linetype=lt)) +
facet_wrap(~lt)
我在 Rstudio 中使用 ggplot 0.9.3.1。