guanglunw
想将这两个长度不同的向量的累积分布函数画在一张图中对比一下!如何实现呢?
daxiawj
par(mfrow=c(1,2))
plot(xxx)
plot(yyy)
详见 ?par
guanglunw
如果将两张图叠加在一张图中呢?
redlou
lines()
yihui
低层作图函数如lines(), points()等会向已有图形中添加元素,高层作图函数如plot(), boxplot(), hist()等会生成新的图形,这种情况下只能拆分作图区域,用par()中的mfrow或者mfcol参数,或者用更灵活的layout()。
有问题先看置顶的FAQ,都回答过很多遍了。
pengchy
matplot()和hist()可以加入add=TRUE参数,就把两个图叠加在一起了,不过要注意两个图x轴的刻度应该一致。
kirsten
[quote]引用第5楼pengchy于2007-11-20 13:24发表的“”:
不过要注意两个图x轴的刻度应该一致。[/quote]
I tried
>par(new=TRUE)
but it's kinda hard to make the two x-axis to be consisted. and I'm not very satisfied with the y-scales but could find a way to adjust them.
How can I acheive that, say... rather than y-scale from 0 to 80%, I would like to see 0-100% so I can know the whole picture.
pengchy
I think you can plot the picture with larger y-scale first.
yihui
事实上是很简单的,只是你需要是先计算你的作图数值的最大值最小值,然后把xlim和ylim参数设定好就是了。
e.g.
plot(runif(100,0,.8),ylim=c(0,1),type='h')
points(runif(100,0,1))