Draw angled ellipses around clusters on PCA plot

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
Mathieu NOE 2023 年 11 月 24 日

0 投票

1 件のコメント

Reed Trende
Reed Trende 2023 年 11 月 28 日
Yes that's perfect, thank you!

サインインしてコメントする。

その他の回答 (2 件)

Matt J
Matt J 2023 年 11 月 29 日
編集済み: Matt J 2023 年 11 月 29 日

0 投票

See also elliipticalFit from the FEX downloadable,
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) );
Matt J
Matt J 2023 年 11 月 29 日

0 投票

Using polyshapes:
ellipse=rotate( scale(nsidedpoly(1000),[2,1]) ,30);
plot(ellipse)

カテゴリ

ヘルプ センター および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

製品

リリース

R2023a

質問済み:

2023 年 11 月 23 日

回答済み:

2023 年 11 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by