使用pdf()遇到特定情节的问题

我'm trying to create a pdf of a TukeyHSD post hoc test plot (through Sweave, but I'也尝试了 pdf() ,产生了相同的结果) . 虽然文档查看器(Ubuntu 10.04)和Acrobat Reader可以显示并且DV打印此... ... "thing"(它应该具有水平置信区间条和垂直虚线) .

alt text

这种情况仅发生在TukeyHSD事后测试图上,所有其他图形打印得很好(在R的绘图设备中打印得很好) . 有没有人经历过这个或类似的东西?我还有什么其他选择?

回答(1)

2 years ago

同样的事情发生在Mac上 . 预览会正确显示它,但Acrobat Reader在带有标签的正确绘制框内没有任何片段 . 尝试在调用中添加col =“black参数失败,但您可以通过在绘制调用的段中重新定义plot.TukeyHSD并使用col =”black“来消除此行为:

plot.TukeyHSD2 <- function (x, ...) {
    for (i in seq_along(x)) {
        xi <- x[[i]][, -4, drop = FALSE]
        yvals <- nrow(xi):1
        plot(c(xi[, "lwr"], xi[, "upr"]), rep.int(yvals, 2), 
            type = "n", axes = FALSE, xlab = "", ylab = "", ...)
        axis(1, ...)
        axis(2, at = nrow(xi):1, labels = dimnames(xi)[[1L]], 
            srt = 0, ...)
        abline(h = yvals, lty = 1, lwd = 1, col = "lightgray")
        abline(v = 0, lty = 2, lwd = 1, ...)
        segments(xi[, "lwr"], yvals, xi[, "upr"], yvals, col="black", ...)
        segments(as.vector(xi), rep.int(yvals - 0.1, 3), as.vector(xi), 
            rep.int(yvals + 0.1, 3), col="black", ...)
        title(main = paste(format(100 * attr(x, "conf.level"), 
            2), "% family-wise confidence level\n", sep = ""), 
            xlab = paste("Differences in mean levels of", names(x)[i]))
        box()
    }
}