(This article was first published on

**Omnia sunt Communia! » R-english**, and kindly contributed to R-bloggers)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:

library(solaR) library(hexbin) aranjuez <- readMAPA(prov=28, est=3, start='01/01/2004', end='31/12/2010') aranjuezDF <- subset(as.data.frame(getData(aranjuez)), 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):

splom(aranjuezDF, panel=panel.hexbinplot, 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) ) panel.lines(d) 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 panel.link.splom. The points are selected via mouse clicks. Clicks other than left-clicks terminate the procedure.

Â

trellis.focus('panel', 1, 1) idx <- panel.link.splom(pch=13, cex=0.6, col='green') aranjuezDF[idx,]

To

**leave a comment**for the author, please follow the link and comment on their blog:**Omnia sunt Communia! » R-english**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...