EPS file from R loads very slow in evince

192 views Asked by At

I'm making an EPS graphic of a scatterplot with a lot of points via R, with lots of data points.

setEPS()
postscript('figure.eps')
...
dev.off()

However, the eps file loads very slowly in evince. I have had similar problems for scatterplots in gnuplot. The eps file has 131,292 lines and is 3.6 megabytes. I recognize for an eps file this is fairly large, but there are a lot of points in the scatterplot.

I've read through the R options and I couldn't find a way to simplify it, is there a way I can alter this eps file so I can load it easily?

1

There are 1 answers

0
con On

The solution to making a scatterplot like this is called 'hexbin' the only problem is that you have to learn an entirely new plotting environment in R, which isn't so fun.

You can see the section 'High Density Scatterplots' here http://www.statmethods.net/graphs/scatterplot.html

I found the following R script to be very useful:

library(hexbin)
x <- read.delim('data.tsv', sep="\t")
bin <- hexbin(x[,1], x[,2], xbins = 500)
setEPS()
postscript('debug.eps')
plot(bin, legend=FALSE, colramp=BTY, xlab ='this will be the xlabel', ylab = 'this will be the ylabel\n\n', main= 'this is the title')
dev.off()

which comes very close to the original scatterplot which is too large to load.