Hi all, I've been trying to figure out how to superimpose a histogram on a biplot that shows the relative contribution of each axis. I have been using the NIPALS function (http://biomserv.univ-lyon1.fr/~dray/ files/softwares/nipals.R) to run principal component analyses. Here is a toy example.
source("http://biomserv.univ-lyon1.fr/~dray/files/softwares/nipals.R") mat=matrix(runif(100,0,1), ncol=10, nrow=10) nipmat=nipals(mat, nf=9) scatter(nipmat) In the plot generated by the above "scatter" command, there is a histogram in the upper left corner. I want to know how to superimpose that histogram on a similar plot, such as the following: groups = as.factor(c(rep(1,2), rep(2,4), rep(3,4))) s.arrow(dfxy=nipmat$co[,1:2]*8, sub="Day 10", possub="bottomleft", csub=3) s.class(dfxy=nipmat$li[,1:2], fac=groups, cellipse=2, axesell=F, cstar=0 , col=c(2:3), add.plot=T) I can create the histogram using: plot(nipmat$eig/sum(nipmat$eig), type='h') but I don't know how to superimpose it on the above graph. Thanks for any help! Best, Jennie Jennie Lavine PhD Candidate Center for Infectious Disease Dynamics Penn State University 505 ASI Building (814)863-1815 [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.