Effacer les filtres
Effacer les filtres

how do to plot points in different colors based on their labels in 2D and 3D?

3 vues (au cours des 30 derniers jours)
ahmed obaid
ahmed obaid le 2 Juil 2017
Commenté : Image Analyst le 2 Juil 2017
Dear experiences...
Im trying to make a plot change its color based on data labels... according to follow: i'm having clustered data points and based on their cluster id (cluster) i need to colored points, so according to my example where clusters =7, i need to plot whole points to 7 colors..
then, i need to plot centroids points also in the same figure... in 2D and 3D in scatter plot, where X,Y and Z columns represent--> my X , Y and Z coordinates of my points,
Point Name X_data Y-Data Z_data class
p1 val val val 1
p2 val val val 2
p3 val val val 3
etc...
pn val val val 7
then for centroids points :
the coordinates of centroids points are in X, Y and Z also
cent_id X Y Z
1 val val val
2 val val val
...
7 val val val
.. So how can i plot these points in dots with different colors for both points and centroids .. and also plot points with labels ( p1, p2...etc) that appear in scatter plot instead of dot.
thanks

Réponses (1)

Image Analyst
Image Analyst le 2 Juil 2017
Why can't you use gscatter()?
For text labels, use text():
text(x,y,txt) adds a text description to one or more data points in the current axes using the text specified by txt. To add text to one point, specify x and y as scalars in data units. To add text to multiple points, specify x and y as vectors with equal length.
  2 commentaires
ahmed obaid
ahmed obaid le 2 Juil 2017
how i can write text in plot or in other function please?
Image Analyst
Image Analyst le 2 Juil 2017
text(2.3, 4.5, 6.7, 'blah blah blah');

Connectez-vous pour commenter.

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