, , , ,

In lattice, there is a function called splom for the display of scatter plot matrices. For large datasets, the panel.hexbinplot from the hexbin package is a better option than the default panel.

As an example, let’s use some meteorological data from MAPA-SIAR:


aranjuez <- readSIAR(prov=28, est=3, start='01/01/2004', end='31/12/2010')

aranjuezDF <- subset(,
 select=c('TempMedia', 'TempMax', 'TempMin',
 'HumedadMedia', 'DirViento', 'EtPMon',
 'Precipitacion', 'G0'))

Now we can use splom with panel.hexbinplot and panel.loess. Besides, I have included some changes to diag.panel in order to show the univariate density of each variable (adapted from here). UPDATED: I include the use of colramp and BTC to change the color of the hexagon bins.

 diag.panel = function(x, ...){
 yrng <- current.panel.limits()$ylim
 d <- density(x, na.rm=TRUE)
 d$y <- with(d, yrng[1] + 0.95 * diff(yrng) * y / max(y) )
 diag.panel.splom(x, ...)
 lower.panel = function(x, y, ...){
 panel.hexbinplot(x, y, ...)
 panel.loess(x, y, ..., col = 'red')
 pscale=0, varname.cex=0.7

Finally, it is interesting to identify some points. This task is easy with The points are selected via mouse clicks. Clicks other than left-clicks terminate the procedure.

trellis.focus('panel', 1, 1)
idx <-, cex=0.6, col='green')