相关疑难解决方法(0)

如何用2个不同的y轴绘图?

我想在R中叠加两个散点图,使得每组点具有其自己的(不同的)y轴(即,在图中的位置2和4),但是这些点看起来叠加在同一图上.

有可能这样做plot吗?

编辑显示问题的示例代码

# example code for SO question
y1 <- rnorm(10, 100, 20)
y2 <- rnorm(10, 1, 1)
x <- 1:10
# in this plot y2 is plotted on what is clearly an inappropriate scale
plot(y1 ~ x, ylim = c(-1, 150))
points(y2 ~ x, pch = 2)
Run Code Online (Sandbox Code Playgroud)

plot r yaxis

115
推荐指数
6
解决办法
17万
查看次数

标签 统计

plot ×1

r ×1

yaxis ×1