Dear Juliet, ggsave uses 300 dpi as default and the png device 72 dpi. The problem seems to be that everything is scaled properly except the pointsize. At least on WinXP. A work around is to increase the theme base_size from 12 to 50 (12 * 300 / 72 = 50).
p <- p + theme_gray(50) ggsave(file = "myoutput2.png", p) HTH, Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [email protected] www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -----Oorspronkelijk bericht----- Van: [email protected] [mailto:[email protected]] Namens Juliet Hannah Verzonden: vrijdag 10 april 2009 16:33 Aan: [email protected] Onderwerp: [R] png with ggplot on windows xp Hi Group, I posted this question on the ggplot list and was advised to try here also. The code below produces a plot as a png and pdf. The pdf looks great, and I cannot make the png look this way. I've tried various combinations of height, width, and dpi, but it has not worked out so far. Any suggestions to make the png look like the pdf? I received a response that the problem does not occur on a Mac, so it may be unique to XP. Thanks for your time. -- Juliet myData <- read.table(textConnection("0.0050 0.70 2903 0.0050 0.80 3406 0.0050 0.90 4170 0.0070 0.70 2072 0.0070 0.80 2431 0.0070 0.90 2976 0.0090 0.70 1610 0.0090 0.80 1889 0.0090 0.90 2312 0.0130 0.70 1112 0.0130 0.80 1305 0.0130 0.90 1598 0.0150 0.70 963 0.0150 0.80 1130 0.0150 0.90 1383 0.0170 0.70 849 0.0170 0.8000 996 0.0170 0.9000 1219 0.021 0.7 686 0.021 0.8 805 0.021 0.9 985"),header=FALSE) closeAllConnections(); colnames(myData) <- c("Effect","Power","N") p <- ggplot(data=myData,aes(x=Effect,y=N)) p <- p+geom_point(aes(shape=factor(Power))) + geom_line(aes(group=factor(Power))) p <- p+scale_x_continuous(expression("Effect Size as "*R^2)) p <- p + scale_shape(name="Power") ggsave(file = "myoutput1.png") ggsave(file = "myoutput1.pdf") > sessionInfo() R version 2.8.1 (2008-12-22) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] grid stats graphics grDevices utils datasets methods base other attached packages: [1] ggplot2_0.8.2 reshape_0.8.2 plyr_0.1.5 proto_0.3-8 ______________________________________________ [email protected] 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. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document. ______________________________________________ [email protected] 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.

