The function ggpairs and ggscatmat in GGally provide generalized pairs plots for a data frame in R. All pairs of variables are displayed, with plot defaults depending on the type of variable in a matrix format. The diagonal contains univariate displays. These functions extend the classic pairs function in base R, which only handles real-valued variables, to flexibly handle different variable types, and to use the graphics package ggplot2.

This is appropriate for multivariate data, because we want to see each variable vs each other. But in many problems, such as regression, or multiple time series, there are two groups of variables, e.g. response variables and explanatory variables, and we would like to see one group vs the other group. New functions are needed to accomplish this.