更改地层图的x轴限制(即多面板图)

时间:2016-01-07 00:07:12

标签: r plot lattice

如何在地层图中手动调整每个面板的x轴限制?

例如,Stratiplot来自analogue

library(analogue)
data(V12.122)
Depths <- as.numeric(rownames(V12.122))

(plt <- Stratiplot(Depths ~ O.univ + G.ruber + G.tenel + G.pacR,
                   data = V12.122,  type = c("h","l","g","smooth")))

enter image description here

我怎样才能将G.ruber的xlim改为c(0.3,0.9),将G.pacR改为c(0,0.75)?

或者,另一种可能性,strat.plot来自rioja

library(rioja)
library(vegan) ## decorana
data(RLGH)
# remove less abundant taxa
mx <- apply(RLGH$spec, 2, max)
spec <- RLGH$spec[, mx > 3]
depth <- RLGH$depths$Depth
#basic stratigraphic plot
strat.plot(spec, y.rev=TRUE)

enter image description here

例如,我怎样才能将TA004A的xlim更改为c(0,20)?

我想我需要提供一些东西来解决底层的格子/基础图代码,但我不知道如何开始使用它。

1 个答案:

答案 0 :(得分:5)

这是一个快速的部分答案,通过调整绘图对象的限制并使用格子额外包来调整面板的大小

# your data
library(analogue)
data(V12.122)
Depths <- as.numeric(rownames(V12.122))

(plt <- Stratiplot(Depths ~ O.univ + G.ruber + G.tenel + G.pacR,
                   data = V12.122,  type = c("h","l","g","smooth")))

# manually change the limits of second panel
# this auto updates ticks and labels
plt$x.limits[[2]] <- c(0.25,0.95) ;

# resize the panels 
latticeExtra::resizePanels(plt, w=c(5,5,5,5))

给出了

enter image description here

然而,这不包括每个段开头的小空格