Different labels are represented by different colors

3 vues (au cours des 30 derniers jours)
Chen yuru
Chen yuru le 29 Oct 2019
Commenté : Chen yuru le 29 Oct 2019
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')

Réponse acceptée

Walter Roberson
Walter Roberson le 29 Oct 2019
Modifié(e) : Walter Roberson le 29 Oct 2019
gscatter(matrix(:,2), matrix(:,3), matrix(:,1))
Notice the gscatter() instead of scatter()

Plus de réponses (0)

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by