2016-07-06 9 views
1

層序プロットの特定のパネルの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"))) 

enter image description here

それは私たちのように、0ではなく、0.4に設定されていますように、私はG.紅色のためのパネルのためのベースラインを設定するにはどうすればよいです上記のプロットを参照してください。

これは、バーが0.4より大きく、値> 0.4がベースラインの右側にあり、値が< 0.4がベースラインの左側にあることを意味します。

おそらく関連:Change x-axis limits on stratigraphic plots (ie. multi-panel plots)

答えて

1

これは汚いハックのビットですが、リンクされたQ & 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)) 

Resulting plot

+0

本当にありがとうございました。私が必要としていたことはまさにその点です。 – Ben

関連する問題