Dear R community, I am creating large graphs with hundreds of thousands of datapoints. My usual way for output was pdf, but now I am getting file sizes of >30Mb that do not open well (or at all) in Adobe. Is there a way to reduce the resolution or get rid of overlaying datapoints? Any other idea is also warmly welcome! Thank you and wishing you a good day! Georg. ********************** Georg Ehret Johns Hopkins Baltimore - US [[alternative HTML version deleted]]
It's probably best to choose a different format like PNG or jpeg. -roger On Tue, Apr 15, 2008 at 5:22 PM, Georg Ehret <georgehret at gmail.com> wrote:> Dear R community, I am creating large graphs with hundreds of > thousands of datapoints. My usual way for output was pdf, but now I am > getting file sizes of >30Mb that do not open well (or at all) in Adobe. Is > there a way to reduce the resolution or get rid of overlaying datapoints? > Any other idea is also warmly welcome! > > Thank you and wishing you a good day! > Georg. > ********************** > Georg Ehret > Johns Hopkins > Baltimore - US > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- Roger D. Peng | http://www.biostat.jhsph.edu/~rpeng/
On 15/04/2008 5:22 PM, Georg Ehret wrote:> Dear R community, I am creating large graphs with hundreds of > thousands of datapoints. My usual way for output was pdf, but now I am > getting file sizes of >30Mb that do not open well (or at all) in Adobe. Is > there a way to reduce the resolution or get rid of overlaying datapoints? > Any other idea is also warmly welcome!A hexbin plot might be an alternative. This is implemented in the hexbin package on Bioconductor. Duncan Murdoch
Look at the hexbin package (bioconductor I think). -----Original Message----- From: "Georg Ehret" <georgehret at gmail.com> To: "r-help" <r-help at stat.math.ethz.ch> Sent: 4/15/08 3:23 PM Subject: [R] heavy graphs Dear R community, I am creating large graphs with hundreds of thousands of datapoints. My usual way for output was pdf, but now I am getting file sizes of >30Mb that do not open well (or at all) in Adobe. Is there a way to reduce the resolution or get rid of overlaying datapoints? Any other idea is also warmly welcome! Thank you and wishing you a good day! Georg. ********************** Georg Ehret Johns Hopkins Baltimore - US [[alternative HTML version deleted]] ______________________________________________ R-help at 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.
Georg Ehret wrote:> Dear R community, I am creating large graphs with hundreds of > thousands of datapoints. My usual way for output was pdf, but now I am > getting file sizes of >30Mb that do not open well (or at all) in Adobe. Is > there a way to reduce the resolution or get rid of overlaying datapoints? > Any other idea is also warmly welcome! >Hi Georg, As others have noted, bitmapped graphics will handle overlaid points better than pdf. You might be able to use the count.overplot function that clumps together points and prints the number of points rather than the points themselves. However, with that many points, you might finish up with a jumble of numbers. Another possibility is to bin the points and print a color matrix that represents the number of points in each bin. # not a very elegant function, the example runs pretty slowly bin.points<-function(x,y,nxbins,nybins) { binmat<-matrix(0,nrow=nybins,ncol=nxbins) xrange<-range(x) yrange<-range(y) xinc<-diff(xrange)/nxbins yinc<-diff(yrange)/nybins for(row in 1:nybins) { for(col in 1:nxbins) { binmat[row,col]<- sum((x >= xrange+xinc*(row-1)) & (x < xrange+xinc*row) & (y >= yrange+yinc*(col-1)) & (y < yrange+yinc*col)) if(col==nxbins) binmat[row,col]<-binmat[row,col] + sum((x == xrange[2]) & (y >= yrange+yinc*(col-1)) & (y < yrange+yinc*col)) } if(row==nybins) binmat[row,col]<-binmat[row,col] + sum((y == yrange[2]) & (x >= xrange+xinc*(row-1)) & (x < xrange+xinc*row)) } return(binmat) } binmat<-bin.points(rnorm(100000),rnorm(100000),20,20) require(plotrix) color2D.matplot(binmat,show.legend=TRUE) Jim