如何在R中合并两个图?

如何在R中合并两个图?,r,plot,error-handling,R,Plot,Error Handling,我试图合并两个绘图,但我的代码不起作用,这是我的代码 a <- runif(10,1,5) b <- runif(10,1,5) c <- runif(10,1,5) d <- runif(10,1,5) plot(a,b,pch=2) plot(c,d,add=TRUE) a对第二个“层”使用points功能: a另一种解决方案: a <- runif(10,1,5) b <- runif(10,1,5) c <- runif(10,1,5) d &

我试图合并两个绘图,但我的代码不起作用,这是我的代码

a <- runif(10,1,5)
b <- runif(10,1,5)
c <- runif(10,1,5)
d <- runif(10,1,5)
plot(a,b,pch=2)
plot(c,d,add=TRUE)

a对第二个“层”使用
points
功能:

a另一种解决方案:

a <- runif(10,1,5)
b <- runif(10,1,5)
c <- runif(10,1,5)
d <- runif(10,1,5)
plot(a,b,pch=2)
par(new = T)
plot(c,d,add=TRUE, axes= F, xlab=NA,ylab=NA)
axis(4)

a可能是此链接有助于标签和左轴上的记号有时可能会变得凌乱,但基本技术工作正常。
a <- runif(10,1,5)
b <- runif(10,1,5)
c <- runif(10,1,5)
d <- runif(10,1,5)
plot(a,b,pch=2)
par(new = T)
plot(c,d,add=TRUE, axes= F, xlab=NA,ylab=NA)
axis(4)