Can I add 95% confidence ellipses around groups of data in a pca plot (biplot)?
Mostrar comentarios más antiguos
I am plotting the results of principle component analysis using biplot. I am wondering if there is a way (in matlab) to add confidence ellipses around the groups of data. Maybe I have to use something instead of biplot?
In the example below I would want to draw an ellipse around the data for each site (green and blue points)
Here's how I am currently plotting the data:
[coeff,score,latent,tsquared,explained] = pca(X);
f1=figure(1)
h= biplot(coeff(:,1:2),'scores',score(:,1:2),'color','k','marker','.','markersize',17,'varlabels',...
{'DO','O2sat','pH','Temp','Sal','Depth','PAR','|Velocity|'});
%color by site
hID = get(h,'tag'); %identify handle
hPt = h(strcmp(hID,'obsmarker')); %isolate handles to scatter points
grp = findgroups(site);
grpID = 1:max(grp);
clrMap = winter(length(unique(grp)));
for i = 1:max(grp)
set(hPt(grp==i), 'Color', clrMap(i,:), 'DisplayName', sprintf('MSP%d', grpID(i)))
end
title('Full Deployment (12h)');
set(gca,'fontsize',18)
xlabel('Component 1 (55.26%)') % how can I add percent ('%s %', explained(1))')
ylabel('Component 2 (21.87%)')
[~, unqIdx] = unique(grp);
legend(hPt(unqIdx))

1 comentario
Heidi Hirsh
el 1 de Oct. de 2020
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Dimensionality Reduction and Feature Extraction en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

