how do to plot points in different colors based on their labels in 2D and 3D?
8 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Image Analyst
2017-7-2
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 个评论
另请参阅
类别
在 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!