现有 R 图中的子图 [英] Subplot in existing R plot
本文介绍了现有 R 图中的子图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个如下图所示的情节.对于这个图,我想在图中的某处(右下角或左下角)添加一种类似的线图.我正在使用的子图的命令是
I have a plot as shown below. To this plot i would like to add a similar kind of line plot somewhere within the plot (bottomright or bottomleft). The command for the subplot i am using is
plot( 1:121, sample(1:121),type='l' )
它就在第一个的顶部.我需要它作为左下角或右下角的小图.有人可以帮助在 R 中做到这一点吗?
It plots right on the top of the first one. I need it as a small plot either at the bottomleft or bottomright. COuld someone help to do this in R?
推荐答案
op <- par(no.readonly = TRUE)
set.seed(42)
plot(rnorm(100), runif(100))
par(new=TRUE, oma=c(3,1,1,2))
layout(matrix(1:4,2))
plot(rnorm(100), runif(100), col="blue", xlab="", ylab="")
par(op)
这篇关于现有 R 图中的子图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文