[R] png with ggplot on windows xp
Juliet Hannah
juliet.hannah at gmail.com
Fri Apr 10 16:32:53 CEST 2009
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
More information about the R-help
mailing list