# Draw angled ellipses around clusters on PCA plot

조회 수: 18 (최근 30일)
Reed Trende 2023년 11월 23일
답변: Matt J 2023년 11월 29일
I would like to draw angled ellipses around clusters in a PCA plot representing the 95% CI for this cluster, similar to what is done by autoplot in R (also, see attached example, or this link https://r-charts.com/correlation/scatter-plot-ellipses-ggplot2/). Any resources for how to do this in matlab, or the math behind how to do this would be much appreciated!
As a note: I did see a post on this forum where people drew ellipses in line with the axes where the height of the ellipse is the 95% CI in X and the width is the 95% CI in Y; this is NOT what I would like, I would like the ellipses at an angle that fits the shape of the clusters, as shown in my examples

댓글을 달려면 로그인하십시오.

### 채택된 답변

Mathieu NOE 2023년 11월 24일
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
Reed Trende 2023년 11월 28일
Yes that's perfect, thank you!

댓글을 달려면 로그인하십시오.

### 추가 답변 (2개)

Matt J 2023년 11월 29일
편집: Matt J 2023년 11월 29일
It can also be used to plot ellipses as well as fit them, e.g.,
[Center,Axes,Angle]=deal([0 2] , [2 1], 30); %Ellipse parameters
plot( ellipticalFit.groundtruth([],Center,Axes,Angle) );
##### 댓글 수: 0이전 댓글 -2개 표시이전 댓글 -2개 숨기기

댓글을 달려면 로그인하십시오.

Matt J 2023년 11월 29일
Using polyshapes:
ellipse=rotate( scale(nsidedpoly(1000),[2,1]) ,30);
plot(ellipse)

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

R2023a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by