【发布时间】:2017-07-10 16:09:59
【问题描述】:
我正在寻找一种将四个区域放入我的情节的方法,这将具有以下矩阵的逻辑:
> matrix(data=c(1,3,2,4),nrow=2,byrow=TRUE)
[,1] [,2]
[1,] 1 3
[2,] 2 4
单元格 1:将是更大的图。真实的情节到处都包含信息,因此添加的图例会阻碍更多 单元格 2:将仅包含图 1 的图例 单元格 3:图 2 单元格 4:图 3
理想情况下,我希望单元格 1 占据 70% 的高度,只为图例提供 30% 的高度,而三个和四个平均共享可用高度。
到目前为止,我已经找到了布局功能,并创建了一些可重现的代码
layout(matrix(data=c(1,3,2,4),nrow=2,byrow=TRUE))
# Figure 1
plot(runif(1000))
#Figure 2 actually is only the legend that does not fit below Figure 1, for my case
plot.new()
legend("bottom",legend="THis is a very big string that will not fit with the Figure above so it has to be below the Figure")
# Figure 3
plot(runif(1000))
# Figure 4
plot(runif(1000))
这段代码创建了一个包含四个区域的图形,遗憾的是我无法根据需要设置比例。尽管我可以使用布局命令设置宽度和高度,但它们对整行有效,而不是按我的需要单独设置。
关于如何进一步调整此代码有什么建议吗?
在此先感谢您的回复 问候 亚历克斯
【问题讨论】: