Plotting the loading of single PCs (PCAtools)
1
0
Entering edit mode
3.3 years ago

Hi,

I recently started using the PCAtools package and was wondering if it ploatloadings command also somehow allows the plotting of individual PCs.

I would be interested in plotting just the loading of PC1.

Overall, the packge works fine and I can modify the number of PCs plotted easily:

plotloadings(p, components = getComponents(pca_object, c(1,2)))

p: a pcaobject created as instructed in the plotloadings help section.

however any attempt to reduce the amount of components plotted below 2 results in the following error:

plotloadings(p, components = getComponents(pca_object, 1)

Error in x[, i] : incorrect number of dimensions

Does anyone know a way to work around this? Or can recommend another package I could use?

Thanks a lot!

PCA PCAtools • 1.1k views
ADD COMMENT
1
Entering edit mode

Thanks a lot! (also for developing this package)

I got the loadings manually for know.

ADD REPLY
1
Entering edit mode
3.3 years ago

Hi, I am the PCAtools [main] developer. I possibly just need to add drop = FALSE when it subsets to just one PC, but I will have to test that.

Temporary alternatives:

  • obtain the loadings manually via pca_object$loadings and plot them manually
  • generate the same plot for 2 or more PCs, and then edit in an external editor.
ADD COMMENT
1
Entering edit mode

Hello again, this should now work in the version that is on GitHub, i.e., selecting just a single PC for plotloadings(). You can install PCAtools direct from GitHub to avail of this. It will take another couple of months before the code is released on the official Bioconductor branch.

ADD REPLY
1
Entering edit mode

Thanks a lot for the quick replies and useful tipps!

ADD REPLY

Login before adding your answer.

Traffic: 2693 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6