Looking for a way to plot a pairwise scatterplot matrix where variables are in two groups, i.e. the plots need to be restricted to pairs between groups, excluding within-group pairs. For instance, the base pairs() produces this
pairs(iris[1:4])
Whereas I am looking to, for example, correlate only sepal variables with petal variables, and am not interested in sepal (or petal) length-to-width correlations. So, instead of a 4x4 matrix, I'd need a 2x2 matrix.
The solution would look something like this
pairs() seems to support a formula argument, but pairs(Sepal.Length + Sepal.Width ~ Petal.Length + Petal.Width, data=iris) doesn't look right. It's in the right direction giving a 3x3 matrix, but for some reason the two sepal variables are grouped.
Preferably looking for a solution in ggplot2 or GGally::ggpairs().



