필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
ahmed obaid
ahmed obaid 2017년 7월 2일
댓글: Image Analyst 2017년 7월 2일
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

답변 (1개)

Image Analyst
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.

카테고리

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