Basic scatterplot matrix



This post explains how to build a scatterplot matrix with base R, without any packages. It provides several reproducible examples with explanation and R code.

Correlogram section Data to Viz

Scatterplot matrix with the native plot() function


For a set of data variables (dimensions) X1, X2, ??? , Xk, the scatter plot matrix shows all the pairwise scatterplots of the variables on a single view with multiple scatterplots in a matrix format.

The native plot() function does the job pretty well as long as you just need to display scatterplots. For more option, check the correlogram section

# Data: numeric variables of the native mtcars dataset
data <- mtcars[ , c(1,3:6)]
 
# Plot
plot(data , pch=20 , cex=1.5 , col="#69b3a2")

Related chart types


Scatter
Heatmap
Correlogram
Bubble
Connected scatter
Density 2d



❤️ 10 best R tricks ❤️

👋 After crafting hundreds of R charts over 12 years, I've distilled my top 10 tips and tricks. Receive them via email! One insight per day for the next 10 days! 🔥