[R] biplot.princomp with loadings only

Gavin Simpson gavin.simpson at ucl.ac.uk
Thu Sep 30 14:36:47 CEST 2004


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?
> 
> thanks
> christoph
> 

Hi Christoph,

Three options I can think of:

1) Hack the source for biplot.princomp and biplot.default (which does 
the plotting) by commenting out the lines that plot the scores or 
altering the code to plot only the scores. You want to plot just y[,1] 
against y[,2] and ignore the x[,1] and x[,2] bits in biplot.default.

2) Write your own function based on biplot.default and biplot.princomp

3) If you don't like hacking/coding then see package vegan and the 
function scores, which has a method for class princomp, which can 
extract the loadings and the scores (in princomp terms, vegan calls them 
something else). Function ordiplot (also in vegan) provides direct 
plotting of various ordination results including objects from princomp.

All the best,

Gav

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson                     [T] +44 (0)20 7679 5522
ENSIS Research Fellow             [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC                 [E] gavin.simpson at ucl.ac.uk
UCL Department of Geography       [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%




More information about the R-help mailing list