Hi, a correction in the previous script. Anyone who tries to use it must ignore (remove) the [,-7] after the Grupos object.
Sorry. De: Rodrigo Aluizio [mailto:r.alui...@gmail.com] Enviada em: terça-feira, 11 de janeiro de 2011 11:01 Para: R Help Assunto: Postscript function Bug at R x64 2.12.1? Hi list. I was saving my modified pairs graphic using a custom panel from the R Graphics site, and I got an interesting difference in the final image when I save it as eps or png. This custom panel make possible to show at the left side of the pairs plot the p-value as symbol and the correlation r value with its cex proportional to the r value itself. Well, when saving as a png file everything is pretty fine. But, if I save it as an eps, one of the r values (0.0056) gets extremely bigger than it should , and its the only one presenting this behavior. P.S.: I use GIMP 2.6.11 (x86) and GhostScript 9.00 (x86) to render the eps file, I dont know if it could be an issue of one of these other softwares. Below are the script that generates everything, a link to an example matrix (csv) and a Sys.info result. The link to an example data http://dl.dropbox.com/u/2613625/Groups.csv The script without the part used to import the data # Analysis cor.prob <- function(X, dfr = nrow(X) - 2) { R <- cor(X) above <- row(R) < col(R) r2 <- R[above]^2 Fstat <- r2 * dfr / (1 - r2) R[above] <- 1 - pf(Fstat, 1, dfr) R } cor.prob(Grupos[,-7]) # Custom upper pairs panel panel.cor <- function(x, y, digits=2, prefix="", cex.cor) { usr <- par("usr"); on.exit(par(usr)) par(usr = c(0, 1, 0, 1)) r <- abs(cor(x, y)) txt <- format(c(r, 0.123456789), digits=digits)[1] txt <- paste(prefix, txt, sep="") if(missing(cex.cor)) cex <- 0.8/strwidth(txt) test <- cor.test(x,y) # borrowed from printCoefmat Signif <- symnum(test$p.value, corr = FALSE, na = FALSE, cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1), symbols = c("***", "**", "*", ".", " ")) text(0.5, 0.5, txt, cex = cex * r) text(.8, .8, Signif, cex=cex, col=2) } # Saving the Graphics postscript('CorMatrix.eps',paper='special',onefile=F,horizontal=F,bg='white' ,width=7,height=7,pointsize=9) # Here the issue pops up par(pty='m') pairs(Grupos[,-7],lower.panel=panel.smooth,upper.panel=panel.cor) dev.off() png('CorMatrix.png',bg='white',width=2800,height=2800,res=300) # Here everything goes fine par(pty='m') pairs(Grupos[,-7],lower.panel=panel.smooth,upper.panel=panel.cor) dev.off() # System Information Sys.info() sysname release version nodename machine login "Windows" "7 x64" "build 7600" "RODRIGO-PC" "x86-64" "Rodrigo" user "Rodrigo" Hope you can help me find out what is going on! Regards ------------------------------------------------------------------- MSc. Rodrigo Aluizio <mailto:r.alui...@gmail.com> [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.