erdogant / pca

pca: A Python Package for Principal Component Analysis.
https://erdogant.github.io/pca
MIT License
284 stars 42 forks source link

How do change the biplot (PC1 and PC2) to other components (like PC1 and PC3 or PC4)? #20

Closed Oceansponge closed 2 years ago

erdogant commented 2 years ago

Thanks for the question. I included PC as an extra parameter in biplot now.

Update with:

pip install -U pca

fig, ax = model.biplot(PC=[0, 1])
fig, ax = model.biplot3d(PC=[0, 1, 2])
Oceansponge commented 2 years ago

Dear Erdogant,

Thanks a lot for your update. That's really helpful.

I updated the pca package as your suggestion. When I call the biplot function (fig,ax = model.biplot(PC = [1, 2]), the arrows for PC2 and PC3 are identical to the ones for PC1 and PC2 (fig,ax = model.biplot(PC = [0, 1]). Could you please double check the code between line 635 and line 679? Some of the variables in the def biplot may need to be updated accordingly (such as mean_x, mean_y, xarrow, yarrow).

Looking forward to your further update.

Many thanks and kind regards, Shuzhuang

erdogant commented 2 years ago

You are right! I will look into it

erdogant commented 2 years ago

I created some fixes. Can you check it?

pip install -U pca

import pca
print(pca.__version__)

version should be >=1.6.1

Oceansponge commented 2 years ago

Perfect! Many thanks for your updates.