フィルターのクリア

scatter plot of 2 colors with X Y and Z data- Z (0 and 1)

2 ビュー (過去 30 日間)
Bhowmik.U
Bhowmik.U 2017 年 3 月 31 日
コメント済み: KSSV 2017 年 3 月 31 日
I have 3 column vectors X Y and Z.
Z is parameter 0 or 1
I wish to plot scatter plot of Z at respective (X,Y) with 2 colors to signify either 0 or 1.
I shall be grateful for any help............

採用された回答

KSSV
KSSV 2017 年 3 月 31 日
編集済み: KSSV 2017 年 3 月 31 日
N = 100 ;
x = rand(N,1) ;
y = rand(N,1) ;
z = rand(N,1) ;
idx1 = (z<0.5) ;
idx2 = (z>0.5) ;
scatter(x(idx1),y(idx1),25,'r','filled');
hold on
scatter(x(idx2),y(idx2),25,'b','filled');
legend('red z < 0.5', 'blue z > 0.5');
  2 件のコメント
Bhowmik.U
Bhowmik.U 2017 年 3 月 31 日
Thanks
This works...however I am curious as to how to bring colorbar or Legend for it
KSSV
KSSV 2017 年 3 月 31 日
legend added...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by