# 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()

## 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()
A post about: , and
##### James Black

Epidemiologist and data scientist.