[R] Using hexbin to Eliminate Indiscernible Points from a Plot

Steve Dutky sdutky at terpalum.umd.edu
Sun Dec 19 17:48:38 CET 2004

Dear all,
I have installed hexbin 1.1-4 package and cobbled together 
the following function, cull, to eliminate xy points closer 
than a specified resolution.   While it appears to reduce the 
congestion of points on a plot, I am surprised to see 
overlapping points remain.

I would appreciate any insight as to what may cause this and 
as to whether a better way to reduce plot congestion may exist.

Thanks, Steve Dutky
sdutky at terpalum.umd.edu

"cull"<-function(x,y,PAR=par(),resolution=PAR$cin[1]/2) {
# returns a logical vector of points that are discernible at 
# the specified resolution.

# requires that either that PAR argument be passed explicity 
# as named list of "cin" and "pin" parameters or that active 
# graphics device already sized for plotting x and y

# PARS$pin == width X height of plot areas in inches

   if (missing(y))  #assume x has two columns


k<-cull(m, resolution=9/72)

More information about the R-help mailing list