필터 지우기
필터 지우기

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 CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by