更改地层图上的基线位置

Change base line position on stratigraphic plots

如何手动调整地层图中特定面板的 x 轴基线位置?

例如,这是来自模拟的 Stratiplot:

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")))

如何设置 G.ruber 面板的基线,使其设置为 0.4,而不是我们在上图中看到的 0?

这意味着条形从 0.4 开始,值 >0.4 到基线右侧,值 <0.4 到基线左侧。

可能相关:

这有点肮脏,但本着您链接的问答的精神,这里有一种方法可以实现:

# Create a dummy variable with the offset (you can also rewrite the column instead)
V12.122$G.ruber.mod <- V12.122$G.ruber-0.4
# Plot as normal
(plt <- Stratiplot(Depths ~ O.univ + G.ruber.mod + G.tenel + G.pacR,
                   data = V12.122,  type = c("h","l","g","smooth")))
# Modify the range so that it takes negative values
plt$x.limits[[2]] <- range(V12.122$G.ruber.mod, na.rm = TRUE)
# Modify where the labels are drawn for that plot:
plt$x.scales$at <- list(O.univ=FALSE,
                        G.ruber.mod=seq(-.1,.1,by=.05),
                        G.tenel=FALSE,
                        G.pacR=FALSE)
# Modify what the labels says for that plot:
plt$x.scales$labels <- list(O.univ=FALSE,
                        G.ruber.mod=seq(-.1,.1,by=.05) + 0.4,
                        G.tenel=FALSE,
                        G.pacR=FALSE)
# Replot:
latticeExtra::resizePanels(plt, w=c(5,5,5,5))