这个问题是从Draw vertical ending of error bar line in dotplot意外的后续行动。引用的问题被成功解决了 - 但有一个警告。当我向点图引入多于三个条件时,它不想绘制垂直刻度| --o-- |在错误栏的结尾处。错误栏蜱| --o-- |不要在dotplot中绘制多于三个条件
由于@Josh的意见建议,我注入browser()
到的功能,吸引了更新panel.Dotplot
,看看有什么不顺心的第一线,但它并没有与任何帮助我解决这个问题出来了。下面是四个条件Dotplot()
的示例代码,其中更新的panel.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)
现在,我得到完整的故事,欢呼声@jbaums!克利夫兰会为我们感到骄傲;-) – 2012-02-29 09:38:00