Question: Plotting the loading of single PCs (PCAtools)
gravatar for carl-philipp.hackstein
9 days ago by
carl-philipp.hackstein20 wrote:


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 • 92 views
ADD COMMENTlink modified 8 days ago • written 9 days ago by carl-philipp.hackstein20

Thanks a lot! (also for developing this package)

I got the loadings manually for know.

ADD REPLYlink written 8 days ago by carl-philipp.hackstein20
gravatar for Kevin Blighe
9 days ago by
Kevin Blighe69k
Republic of Ireland
Kevin Blighe69k wrote:

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 COMMENTlink modified 9 days ago • written 9 days ago by Kevin Blighe69k

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 REPLYlink written 6 days ago by Kevin Blighe69k

Thanks a lot for the quick replies and useful tipps!

ADD REPLYlink written 4 days ago by carl-philipp.hackstein20
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 996 users visited in the last hour