how to use gscatter in matlab 2012b?

4 ビュー (過去 30 日間)
Muazma Ali
Muazma Ali 2017 年 9 月 7 日
編集済み: KSSV 2017 年 9 月 7 日
Hi, I am using matlab 2012b, and wondering whether the grouping variable in the following command has to be a categorical variable. gscatter(x,y, group).

回答 (1 件)

KSSV
KSSV 2017 年 9 月 7 日
YOu need not to worry about gscatter, you may plot like this:
data = rand(100,2) ;
x = data(:,1) ; y = data(:,2) ;
%%Assign three categories
cat = zeros(100,1) ;
cat(randperm(100,25)) = 1 ;
cat(randperm(100,30)) = 2 ;
cat(randperm(100,45)) = 3 ;
%%plot
figure
hold on
for i = 1:3
plot(x(cat==i),y(cat==i),'.','color',rand(1,3),'markersize',20)
end
  2 件のコメント
Muazma Ali
Muazma Ali 2017 年 9 月 7 日
well I need a 3d plot and have a datset with my columns and I want one of them to be a grouping variable column
KSSV
KSSV 2017 年 9 月 7 日
編集済み: KSSV 2017 年 9 月 7 日
ok....so what worry?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by