data(NHANES)
hbin<-hexbin(log(NHANES$Diet.Iron+1),log(NHANES$BMI),xbins=25,IDs=TRUE)
hvp<-plot(hbin)
mtrans<-hexTapply(hbin,NHANES$Transferin,median,na.rm=TRUE)
pushHexport(hvp$plot.vp)
grid.hexagons(hbin,style='lattice',pen=0,border='red',use.count=FALSE,
cell.at=mtrans)
Run the code above in your browser using DataLab