gplotmatrix matlab,Use of grouping variables in gplotmatrix

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])

382ba3234b819e366a7d91901027cf49.png

Oleg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值