Reputation: 70643
I'm trying to create a pdf of a TukeyHSD post hoc test plot (through Sweave, but I've tried pdf()
, too, yielding same result). While Document viewer (Ubuntu 10.04) and Acrobat Reader can't display the plot properly, Foxit reader has no problems.
Acrobat Reader displays an error that the image can't be displayed and DV prints this... "thing" (it should have horizontal confidence interval bars and a vertical dotted line).
This happens only for TukeyHSD post hoc test plots, all other figures print just fine (plot prints fine in the R's plotting device). Has anyone experienced this or something similar? What are my other options?
Upvotes: 1
Views: 214
Reputation: 263391
Same thing happens on a Mac. Preview displays it properly but Acrobat Reader has no segments inside a properly drawn box with labels. Attempting to add a col="black argument to the call failed, but you can make the behavior go away by redefining plot.TukeyHSD with col="black" in the segment plotting calls :
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()
}
}
Upvotes: 1