使用ggplot2,我如何绘制一个在facet之间运行的趋势线.
library(ggplot2)
df <- data.frame(y=c(1,2,3),x=1,Set=LETTERS[1:3])
ggplot(df,aes(x,y)) +
theme_bw() + theme(legend.position=c(0,1),legend.justification=c(0,1)) +
geom_point(aes(fill=Set),color="black",shape=21,size=3) +
facet_grid(~Set) +
xlim(1,5)
Run Code Online (Sandbox Code Playgroud)
产生以下内容:
在上面,我想在这三点之间画一条线,横过小平面.