I have a histogram with several hundred items, for which I do a Q-Q plot. This results in EPS that is 2.5 megabytes large. This is too much for a figure that is only going to be included in a publication and is not going to be viewed at 100x magnification.
Is there any option in R to somehow output smaller EPS? I have searched docs to no avail. Or is my best option to, say, rasterize it afterwards at 300 dpi? If that's the case, any recommendations for the tool for this job?
The R code for the plot is nothing fancy:
postscript(filename)
qqnorm(n, main=title))
qqline(n)
dev.off()
EDIT: Doh! My question mentioned outputting EPS, and then converting it to some raster format. When of course I could just generate PNG in the first place from R.
I've just tried several things that didn't work - I'm including them here to save others wasting their time. For reference, I set n <- rnorm(1e5)
in your code above.
Things that don't work:
Setting colormodel <- "gray"
.
Using a different value of pch. (Some other values increase the file size, but I found none that decrease it.)
Setting useKerning = FALSE
.
Changing the width and height settings.
Using pdf instead of postscript.
Using CarioPS from the Cairo package.
In the light of this, I think that you are unlikely to be able to decrease the file size using a vector format. This means that you will have to use a raster format (most likely PNG).