2012-02-28 9 views
5

この質問は予期しないフォローアップDraw vertical ending of error bar line in dotplotです。引用された質問は首尾よく解決されましたが、警告があります。ドットプロットに3つ以上の条件を導入すると、縦方向のダンプを描画したくない| --o-- |エラーバーの終わりに。エラーバーのティック| --o-- |ドットプロットで3つ以上の条件を引き出さないでください

@Joshがコメントで示唆したように、私はpanel.Dotplotを更新してそれを解決するのに役立つものは何も出てこなかった最初の行にbrowser()を注入しました。以下は、更新されたpanel.Dotplot関数が動作しない4条件のDotplot()のコードの例です。

require(Hmisc) 
#Fake conditions 
mean = c(1:18) 
lo = mean-0.2 
up = mean+0.2 
name = c("a","b","c") 
cond1 = c("A","B","C") 
cond2 = c(rep("E1",9),rep("E2",9)) 
d = data.frame (name = rep(name,6), mean, lo, up, 
       cond1=rep(cond1,each=3,times=2), cond2) 
# Create the customized panel function 
mypanel.Dotplot <- function(x, y, ...) { 
     panel.Dotplot(x,y,...) 
     tips <- attr(x, "other") 
     panel.arrows(x0 = tips[,1], y0 = y,x1 = tips[,2], 
       y1 = y,length = 0.1, unit = "native", 
       angle = 90, code = 3) 
} 
#Draw Dotplot - `panel.Dotplot` doesn't change anything 
setTrellis() 
Dotplot(name ~ Cbind(mean,lo,up) | cond1 * cond2, data=d, ylab="", xlab="",col=1, 
     panel = mypanel.Dotplot) 

enter image description here

答えて

5

エラーバーは、実際にレンダリングされているが、それらの非常に短いには表示されません:それはあなたが条件の数を(上記引用した質問に対する答えを確認してください)減少した場合、動作します長さ(±0.2単位)。あなたの本当のデータは相対的なので、正確である場合

lattice error bars

次の1件の結果を(0.5 - - エラーバーキャップの長さ、すなわち私もpanel.arrowsで指定lengthを高めてきました)、±誤差を増やしますx値の範囲に設定すると、小さな点(エラーバーをあいまいにする傾向がありません)またはx軸を誇張したレイアウトを考慮する必要があります。例えば、以下は±0.2単位のあなたの元のエラーを使用し、0.1の元の矢印キャップlength

Dotplot(name ~ Cbind(mean,lo,up) | cond1 * cond2, data=d, ylab="", xlab="", 
    col=1, panel = mypanel.Dotplot, pch=20, cex=0.4, layout=c(1, 6), strip=FALSE, 
    strip.left=strip.custom(par.strip.text=list(cex=0.75), bg=0, fg=0)) 

lattice precise error bars

+0

今、私は完全な物語、歓声の@jbaumsを持って!クリーブランドは私たちを誇りに思います;-) –

関連する問題