How to add legend in a 3D scatter plot?
Ältere Kommentare anzeigen
I have following piece of code. I am using tsne visualization to plot 3D scatter plot. But I am unable to find a way to add legends.
clear all; clc; close all;
load('trLabels.mat')
load('trFeatures.mat')
X = trSets;
L = labels;
rng default % for fair comparison
Y3 = tsne(X,'Algorithm','barneshut','NumPCAComponents',20,'NumDimensions',3);
figure
scatter3(Y3(:,1),Y3(:,2),Y3(:,3),15,L,'filled', '');
colormap( jet(numel(unique(L))) )
Antworten (1)
madhan ravi
am 5 Jul. 2020
legend(' :) ')
5 Kommentare
Hassan Ashraf
am 5 Jul. 2020
madhan ravi
am 5 Jul. 2020
legend(compose('Entry %d', 1:11))
Hassan Ashraf
am 5 Jul. 2020
madhan ravi
am 5 Jul. 2020
Bearbeitet: madhan ravi
am 5 Jul. 2020
Can’t help without looking at your file, I would see 11 calls to scatter3() or a loop whereas you have only one ? and you expect 11 entries?
Hassan Ashraf
am 5 Jul. 2020
Kategorien
Mehr zu Legend finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

