R Under development (unstable) (2024-11-12 r87322 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(hexbin) > > ## a variation on Nicholas' post to bioconductor & example(hexViewport) > set.seed(545) > x <- rnorm(2^15) > y <- 3*x - .2*x^2 + rnorm(2^15) > hbin <- hexbin(x,y) > > ## > hp <- hexViewport(hbin, newpage = TRUE) > pushHexport(hp) > library("grid") > grid.rect() > grid.xaxis() > grid.yaxis() > grid.hexagons(hbin, style = "centroid") > hloess <- loess(y ~ x, data = hcell2xy(hbin), weights = hbin @ count) > xx <- seq(hbin@xbnds[1], hbin@xbnds[2], length = 500) > grid.lines(xx, predict(hloess, xx), + gp = gpar(col = 'red', lwd = 2), default.units = "native") > popViewport() > > proc.time() user system elapsed 0.45 0.10 0.50