[R] scatterplot of 100000 points and pdf file format

Greg Snow greg.snow at ihc.com
Wed Nov 24 21:32:22 CET 2004


How about the following to plot only the 1,000 or so most extreem points
(the outliers):

x <- rnorm(1e6)
y <- 2*x+rnorm(1e6)

plot(x,y,pch='.')

tmp <- chull(x,y)

while( length(tmp) < 1000 ){
	tmp <- c(tmp, seq(along=x)[-tmp][ chull(x[-tmp],y[-tmp]) ] )
}

points(x[tmp],y[tmp], col='red')

now just replace the initial plot with a hexbin or contour plot and you
should have something that takes a lot less room but still shows the
locations of the outer points.



Greg Snow, Ph.D.
Statistical Data Center
greg.snow at ihc.com
(801) 408-8111




More information about the R-help mailing list