我在 R 中使用 layout() 来生成一系列 9 个图形(以 3x3 布局)
m <- rbind(c(1,2,3), c(4,5,6), c(7,8,9))
layout(m)
我试图在三列之间放置 2 条垂直线,以便将这些列彼此分开。 box() 不合适,因为我希望将行链接起来,所以不希望在那里有行,而且我正在努力寻找使用 line() 函数的任何帮助,任何想法都将不胜感激。
谢谢
最佳答案
如果您更改图形参数以便将所有绘图剪切到设备区域,然后使用 abline()
添加垂直线以进行分隔会怎样? ?例如:
m <- rbind(c(1,2,3), c(4,5,6), c(7,8,9))
# Clips drawing to the device region
# See ?par for more details of the argument
par(xpd=NA)
layout(m)
# Insert you nine plots here
for(i in 1:9) {
plot(1,1)
}
# Check the correct coordinates with
# locator(), and the arguments
# accordingly. These are about right,
# if the plot region is rectangular.
abline(v=0.25)
abline(v=-1.06)
结果图如下所示。
关于r - 在 R 中使用 layout() 划分图形的线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23778759/