. 나는 classID
대신 class
대신 @gnovice에 동의합니다. 당신은 범례를 표시하려면
scatter(X(:,1),X(:,2),6,classID); %# the 6 sets the size of the marker.
편집
, 당신은 @yuk 년대, 또는 @gnovice 솔루션을 사용하는 하나 있습니다.
GSCATTER
%# plot data and capture handles to the points
hh=gscatter(randn(100,1),randn(100,1),randi(3,100,1),[],[],[],'on');
%# hh has an entry for each of the colored groups. Set the DisplayName property of each of them
set(hh(1),'DisplayName','some group')
PLOT 당신은 또한 통계 도구 상자가있는 경우 grouped data 좀보고 할 수 있습니다
%# create some data
X = randn(100,2);
classID = randi(2,100,1);
classNames = {'some group','some other group'}; %# one name per class
colors = hsv(2); %# use the hsv color map, have a color per class
%# open a figure and plot
figure
hold on
for i=1:2 %# there are two classes
id = classID == i;
plot(X(id,1),X(id,2),'.','Color',colors(i,:),'DisplayName',classNames{i})
end
legend('show')
.
+1 : 쿨! SCATTER에 대한 네 번째 입력을 알아 채지 못했습니다. – gnovice
흥미로운 점은, 클래스를 세 번째 인수로 classID와 동일한 길이로 사용하여 클래스를 기호 크기로 구분할 수 있다는 것입니다. bubbleplot을 그릴 때'scatter (X (:, 1), X (:, 2), classID * 1000, 'r.')'를 시도하십시오. – yuk
감사합니다. 발견했는데 자네가 더 좋다. gscatter (m (:, 2), m (: 1), classID, 'brgyckm', 'o') – Hossein