Overlaying two PCA plots

Issue #194 resolved
Former user created an issue

Hello, I'm trying to overlay two PCA plots on one another. I have tried using the points system within R and can't seem to get it to work. Basically, I'm trying to show the difference in PC1 vs PC2 for an all CA atom protein and its active site with two different ligands bound. Is there a method of doing this?

Thank you!

Comments (3)

  1. Lars Skjærven

    Use plot in combination with points() (exemplified here with the transducin data set):

    attach(transducin)
    pc.xray <- pca.xyz(pdbs$xyz, rm.gaps=TRUE)
    
    plot(pc.xray$z[,1:2])
    points(pc.xray$z[,1:2], pch=16, col=4, cex=0.5)  
    

    (here I plot the same twice, so replace the pc.xray in the call to points with whatever your have).

    alternatively plot in combination with par(new=TRUE)

    plot(pc.xray$z[,1:2])
    par(new=TRUE)
    plot(pc.xray$z[,1:2], pch=16, col=4, cex=0.5)
    

    (set ylim and xlim to make sure both plots are on the same scale. Use axes=FALSE to avoid that axes are plotted twice).

    A better option would probably be to make two adjacent plots. e.g.

    par(mfrow=c(1,2))
    plot(pc.xray$z[,1:2])
    plot(pc.xray$z[,1:2])
    
  2. Log in to comment