[R] prcomp : plotting only explanatory axis arrows

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Dec 24 12:35:17 CET 2009


First, this is about biplot, not prcomp.

Second, you seem to want to get a single-variable plot out of a 
biplot, which contradicts the 'bi' and hence I would not expect there 
to be a simple way to do this.

The simplest thing to do would be to edit biplot.default via

biplot.default <- stats:::biplot.default
fix(biplot.default)

and comment out the bits you want to suppress (both text() calls if I 
get your drift, but I would want to remove axes that relate to 
variables I am not plotting).

For more than once-off use I would create my own function after 
reading stats:::biplot.prcomp and stats:::biplot.default.

On Wed, 23 Dec 2009, milton ruser wrote:

> Dear all,
>
> I have a very large dataset (1712351 , 20) and would like
> to plot only the arrows that represent the
> contribution of each variables.
> On the sample below I woild like to plot
> only the explanatory variables (Murder, Assault..)
> and not the sites.
>
> prcomp(USArrests)  # inappropriate
> prcomp(USArrests, scale = TRUE)
> prcomp(~ Murder + Assault + Rape, data = USArrests, scale = TRUE)
> plot(prcomp(USArrests))
> summary(prcomp(USArrests, scale = TRUE))
> biplot(prcomp(USArrests, scale = TRUE))
> Thanks a lot,
>
> milton
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list