如何在地层图中手动调整特定面板的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。
可能相关:Change x-axis limits on stratigraphic plots (ie. multi-panel plots)
答案 0 :(得分:1)
这是一个肮脏的黑客,但是,根据您所链接的Q&amp; A的精神,这是实现这一目标的一种方式:
# 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))