plotmatrix
Matrix of scatter plots of the columns of a data matrix against each other.
Category: Graphics > 2-D and 3-D Plots
Syntax
plotmatrix(X)
Plots every column of X against every other, with histograms on the diagonal.
plotmatrix(X, Y)
Plots the columns of X against the columns of Y.
[h, ax, bigax] = plotmatrix(___)
Also returns the point handles, the small axes and the large axes that surrounds them.
Description
For p variables the plot is a p-by-p grid. Cell (i,j) shows variable j on the horizontal axis against variable i on the vertical axis. It reveals pairwise relations, clusters and outliers at a glance.
Input arguments
X- Matrix with observations in rows and variables in columns.
Y- Second matrix with the same number of rows.
Output arguments
h- Matrix of handles of the scatter lines.
ax- Matrix of handles of the small axes.
bigax- Handle of the invisible axes that holds the whole grid.
Example
Three random variables
rng(1)
X = rand(30, 3);
X(:,3) = X(:,1) + 0.2*X(:,3);
plotmatrix(X)
In the app, the figure is drawn below the code.