if(require(marray)){
data(swirl)
hb <- plotMAhex(swirl[,1], main = "M vs A plot with hexagons", legend=0)
hexVP.abline(hb$plot, h=0, col= gray(.6))
hexMA.loess(hb)
}
dat <- data.frame(x=rnorm(1000), y=rnorm(1000))
bin <- hexbin(dat$x, dat$y)
hb <- plot(bin)
hexVP.loess(bin, hvp = hb$plot.vp, span = 0.4, n = 200, col = "blue", lwd = 3, lty = "dashed")
Run the code above in your browser using DataLab