Different labels are represented by different colors
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello,
I have a scatter plot like figure1.
But I would like to show that same name with same color, different name with deferent color.
And also shown on legend.
As shown in Figure2, First row is name , second and third row are data.
Attachment is Test.mat , included matrix value .
Thanks.
Figure1:

Fifure2:

load test.mat
scatter(matrix(:,2),matrix(:,3),'ko','MarkerFaceColor','k')
댓글 수: 0
채택된 답변
Walter Roberson
2019년 10월 29일
편집: Walter Roberson
2019년 10월 29일
gscatter(matrix(:,2), matrix(:,3), matrix(:,1))
Notice the gscatter() instead of scatter()
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Scatter Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!