gplotmatrix
statistics: gplotmatrix (x, y, group)
statistics: gplotmatrix (x, [], group)
statistics: gplotmatrix (x, y, group, clr, sym, siz)
statistics: gplotmatrix (…, doleg, dispopt)
statistics: gplotmatrix (…, doleg, dispopt, xnam, ynam)
statistics: gplotmatrix (parent, …)
statistics: [h, ax, bigax] = gplotmatrix (…)
Create a matrix of scatter plots grouped by a categorical variable.
gplotmatrix (x, y, group) creates a matrix of
scatter plots. Each subplot in the resulting figure is a scatter plot of a
column of x against a column of y. If x is n-by-p
and y is n-by-q, the resulting figure holds a
q-by-p grid of subplots; the subplot in row i and column
j plots x(:,j) on the horizontal axis against
y(:,i) on the vertical axis. Points are grouped and colored
according to group, which is a grouping variable (numeric, logical,
character, string, or cell array of strings) with one entry per row of
x.
gplotmatrix (x, [], group) is equivalent to
gplotmatrix (x, x, group) except that the diagonal of
the p-by-p grid is replaced by grouped histograms of the columns
of x.
The appearance of the plot is controlled by further positional arguments:
"rgb") or as a matrix of RGB triplets, one row per group. Colors
cycle if fewer are supplied than there are groups."o+x"); defaults to
".". Symbols cycle if fewer are supplied than there are groups."on" (default) to display a legend of the groups or
"off" to suppress it."stairs"
(default) for grouped stairstep histograms, "hist" or
"grpbars" for grouped bar histograms, "none" to leave the
diagonal empty, or "variable" to write the variable names on the
diagonal.An optional leading parent argument (a figure or uipanel handle) selects the container for the plot.
The optional outputs are h, an array of handles to the plotted objects with size ny-by-p-by-k (where ny is the number of rows of the grid and k the number of groups); ax, the matrix of handles to the subplot axes (with an extra row of hidden axes for the diagonal histograms); and bigax, the handle to the invisible enclosing axes used for titles and labels.
See also: gscatter, plotmatrix, grpstats
Source Code: gplotmatrix
Grouped scatter-plot matrix of Fisher's iris measurements.
load fisheriris; gplotmatrix (meas, [], species);
Two sets of variables plotted against each other by group.
load fisheriris; gplotmatrix (meas(:,1:2), meas(:,3:4), species);