Use of grouping variables in gplotmatrix
Answers (1)
0 votes
The help of gplotmatrix is:
" gplotmatrix(x,y,group,clr,sym,siz) specifies the color, marker type, and size for each group. clr is a string array of colors recognized by the plot function. The default for clr is 'bgrcmyk'. sym is a string array of symbols recognized by the plot command, with the default value '.'. siz is a vector of sizes, with the default determined by the DefaultLineMarkerSize property. If you do not specify enough values for all groups, gplotmatrix cycles through the specified values as needed."
So I would use it as:
gplotmatrix(x,y,group,'grc','vos',[9,8,7])
See LineSpec for line style, color and marker specifiers.
More importantly, I would use gscatter instead of gplotmatrix, because you actually want to plot y against the three x, i.e. using grouping on the same scatter, you would see different clouds for the three combinations:
% Fake data y = (1:10).'; x = bsxfun(@plus,rand(10,3),[1,5,9]);
% Adapt inputs: szX = size(x); y = repmat(y,szX(2),1); group = reshape(repmat(1:szX(2),szX(1),1),[],1); x = x(:); % Gscatter gscatter(x,y,group,'grc','vos',[11,9,7])

Oleg
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!