R语言中把几张图画在同一坐标系下怎么画

如题所述

先大概考虑一下坐标范围,要满足几个图的摆放。
比如,X 范围 xa~xb Y范围 ya~yb
然后画第一张图,坐标范围设定为 xlim=c(xa,xb) ,ylim=c(ya,yb)
然后画其他图线,注意加 add=TRUE 参数设定。就能画出来很多图线了。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-08-10
require(ggplot2)
vd = rbind(data.frame(v=vd1, y=y, t=as.factor(1)), data.frame(v=vd2, y=y, t=as.factor(0)))
ggplot(vd, aes(x=v, y=y)) + geom_point(aes(color=t))
第2个回答  推荐于2018-01-13
require(ggplot2)
vd = rbind(data.frame(v=vd1, y=y, t=as.factor(1)), data.frame(v=vd2, y=y, t=as.factor(0)))
ggplot(vd, aes(x=v, y=y)) + geom_point(aes(color=t))本回答被网友采纳
相似回答