Scatter plot matrix with R

Mixed variables

Scatter plot matrices tend to be something I always run, but never present. So I don’t bother with making them pretty. My two favourite functions are ggpairs, and corrgram.

png("scattermatrix.png")
ggpairs(mydata,
        #axisLabels = "none"
)
dev.off()
Scatterplot matrix of pairwise correlations. Plot type is defined by data in each pair.

All continuous

This second plot type doesn’t handle discrete variables, so is good when you just want continuous vs. continuous pairs.

png("scattermatrix_corrgram.png")
corrgram(mydata,
         order=FALSE, lower.panel=panel.pts,
         upper.panel=panel.ellipse, text.panel=panel.txt,
         diag.panel=panel.minmax)
dev.off()
Scatterplot using an alternative plotting function (this one can't handle categories as well).
A post about: , and

You May Also Enjoy