having trouble with a specific plot using pdf()

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?

Answers


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()
    }
}

Need Your Help

Testing touchscreen with Android Emulator?

java android android-emulator touchscreen

Is it possible to simulate or test Touchscreen input with the Android Emulator?

HTML authoring in an editorial environment

html wysiwyg

Having recently produced an HTML/CSS/Javascript based report from various word and excel files sent to me I'm trying to work out how to do this better in future, ideally enabling non-technical user...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.