[R] biplot.princomp with loadings only

Kjetil Brinchmann Halvorsen kjetil at acelerate.com
Mon Oct 4 14:32:15 CEST 2004


Jari Oksanen wrote:

>On Thu, 2004-09-30 at 10:33, Christoph Lehmann wrote:
>  
>
>>Hi
>>
>>is there a way to plot only the loadings in a biplot (with the nice 
>>arrows), and to skip the scores?
>>
>>    
>>
Just let me point out that there is a function for this in the
CRAN package ade4,    s.corcircle

library(ade4)
example(s.corcircle)

Kjetil


>Christoph,
>
>I may have overlooked some email messages, but it seems to me that you
>haven't yet got an answer to your practical question. From the practical
>point of view, we may skip the point that you rather ask for a
>"monoplot" than "biplot" if you have only one set of points. Further, I
>may forget my surprise when I see that somebody really thinks that these
>arrows are "nice". OK, they may be nice if you have only a couple of
>them, but anybody plotting 30 or more arrows normally asks how to get
>rid off this mess. 
>
>Of course you can plot arrows in your "monoplot", since you have got
>access to everything in R and you can do anything with R (but coffee
>comes somewhat bland, so I recommend something else for the task cooking
>coffee). Here is an example:
>
># Run PCA
>data(USArrests)
>sol <- princomp(USArrests, cor=T)
># Extract loadings
>X <- sol$loadings
># Plot the frame
>plot(X, asp=1, type="n")
>abline(v=0, lty=3)
>abline(h=0, lty=3)
># Plot arrows: see ?arrows for the syntax
>arrows(0, 0, X[,1], X[,2], len=0.1, col="red")
># Label the arrows
>text(1.1*X, rownames(X), col="red", xpd=T)
>
>Cheers, jari okanen
>  
>



-- 

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
               --  Mahdi Elmandjra




More information about the R-help mailing list