更改地层图(即多面板图)的x轴限制 [英] Change x-axis limits on stratigraphic plots (ie. multi-panel plots)

查看:95
本文介绍了更改地层图(即多面板图)的x轴限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How can I manually adjust the x axis limits for each panel in a stratigraphic plot?

例如,这是analogue中的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的xlim更改为c(0.3,0.9),将G.pacR的xlim更改为c(0,0.75)?

How could I, for example, change the xlim of G.ruber to c(0.3, 0.9) and G.pacR to c(0, 0.75)?

或者,另一种可能性,这是rioja中的strat.plot:

Or, another possibility, here is strat.plot from 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)

例如,如何将TA004A的xlim更改为c(0,20)?

How could I, for example, change the xlim of TA004A to c(0, 20)?

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

I guess that I need to supply something to address the underlying lattice/base plot code, but I'm not sure how to get started with that.

推荐答案

这是快速解决问题的方法,方法是调整绘图对象的限制并使用格外Extra软件包调整面板大小

This is a quick part answer by tweaking the limits of the plot object and using the lattice Extra package to resize the panels

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

给出

但是,这不包括每个段开头的小空白

This however does not include the small blank space at the start of each segment

这篇关于更改地层图(即多面板图)的x轴限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆