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

标签 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)?

我想我需要提供一些东西来解决底层的格子/基图代码,但我不确定如何开始。

最佳答案

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

# 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

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

关于r - 更改地层图(即多面板图)上的 x 轴限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34645201/

相关文章:

R: test_that 多个对象是否相等

python - matplotlib:在时间序列图中将周期标签置于周期数据的中心

r - 将水平图上的数字刻度标记更改为字母

javascript - 使用 R 将字段添加到在线表单并抓取生成的 javascript 创建的表

r - 计算csv文件中每个字段的最大长度

mysql - 寻找相似的用户

python - 具有不规则间隔样本的 2D 彩色图 (matplotlib.mlab.griddata)

matlab - 如何使 MATLAB 的 xlim 自动且围绕 0 对称?

r - 在同一面板中绘制多个直方图

r - 在 HH 包的 Likert 函数中自定义 x 轴刻度线