hexbin(x, y, xbins=30, shape=1, xlim=range(x), ylim=range(y))
The returned data frame has attributes:
x <- rnorm(10000) y <- rnorm(10000)bin1 <- hexbin(x,y) trellis.device(motif) plot(bin1,style="nested.centroids")
# Lower resolution binning and overplotting with counts bin2 <- hexbin(x,y,xbins=25) binpar <- plot(bin2, style="latt" ,minarea=1, maxarea=1, density=0, border=T) oldpar <- par(binpar) # reset graphics to the plot on the screen xy <- cell2xy(bin2) text(xy$x, xy$y, as.character(bin2$count), adj=.5, cex=.3) par(oldpar) # restore old graphics parameters
maples <- lansing[lansing$species=="maple",] plot(maples$x,maples$y) maple.bin <- hexbin(maples$x,maples$y,xbins=10) hexagons(maple.bin,border=T,dens=0)