【发布时间】:2015-11-15 22:39:05
【问题描述】:
我需要并排放置 2 列图(示例中只有一行),我无法控制图的大小和标签的位置,以便两个图完全对齐。这是现在拥有的代码:
split.screen(c(1,2))
screen(1)
par(oma=c(0,1,0,0), mai=c(0.6,0.36,0.5,0.7), cex=0.5, mgp = c(0.5,0.1, 0), tck = -0.05)
plot(datos$UN.CJF*1000, datos$Methane.Produced.CJF, pch = 16, cex = 0.5, col ="black",
xlab = "UN (g/d)", ylab = expression('CH'[4]*'(g/d)'))
title(main = "a)", cex=0.8, line=0.5, adj=0, cex.lab=1.2)
datos$LWchangeD.CJF <- datos$LWchange.CJF/15
screen(2)
par(oma=c(0,1,0,0), mai=c(0.6,0.36,0.5,0.7), cex=0.5, mgp = c(0.5,0.1, 0), tck = -0.05)
scatter2D(datos$UN.CJF*1000, datos$Methane.Produced.CJF,
pch = 16,
xlab = "UN (g/d)", ylab = "",
colvar = datos$LWchangeD.CJF, clab = c("Liveweight change (kg/d)")
)
title(main = "b)", cex=0.8, line=-0.7, adj=0, cex.lab=1.2)
Notice how the size of the 2 figs is different
必须有更好的方法来做到这一点。 任何帮助将不胜感激
阿尔瓦罗
【问题讨论】:
-
@Bg1850:
grid.arrange似乎不太可能对基本@987654326@ 输出有用。它们是完全不同的绘图范例。 -
@Alvaro。大小具体是多少?并进行编辑以包含所有非默认包的库调用。 (我会说 x 轴是主要区别。)
-
在 Bg1850 的基础上,这里有一种使用 grid.arrange 和 base R plots 的方法:stackoverflow.com/questions/33612468/…