Re: [R] heavy graphs

2008-04-16 Thread Jim Lemon
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(10),rnorm(10),20,20)
require(plotrix)
color2D.matplot(binmat,show.legend=TRUE)

Jim

__
R-help@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.


Re: [R] heavy graphs

2008-04-15 Thread Roger Peng
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 [EMAIL PROTECTED] 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@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/

__
R-help@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.


Re: [R] heavy graphs

2008-04-15 Thread Bert Gunter
But you also might have the additional problem that too many data points
just produce an incoherent solid blob, no matter the format.

Lots of folks have written about this. Check out JCGS and computer graphics
literature for ideas. Also,this is one arena where fancy, dynamic,
interactive software (maybe xgobi) might be useful. Maybe not (too much
data).

Finally, canonical answer: **appropriately** sample and plot only the sample
data. The key is in defining appropriately,of course.

-- Bert Gunter
Genentech

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Roger Peng
Sent: Tuesday, April 15, 2008 2:34 PM
To: Georg Ehret
Cc: r-help
Subject: Re: [R] heavy graphs

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 [EMAIL PROTECTED] 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@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/

__
R-help@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.

__
R-help@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.


Re: [R] heavy graphs

2008-04-15 Thread Duncan Murdoch
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

__
R-help@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.


Re: [R] heavy graphs

2008-04-15 Thread Greg Snow
Look at the hexbin package (bioconductor I think).

-Original Message-
From: Georg Ehret [EMAIL PROTECTED]
To: r-help [EMAIL PROTECTED]
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@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.

__
R-help@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.