[R] How does biplot.princomp scale its axes?

Patrick Connolly p_connolly at ihug.co.nz
Mon Jul 31 23:47:35 CEST 2006


I'm attempting to modify how biplot draws its red vectors (among other
things).  This is how I've started:


Biplot <- function(xx, comps = c(1, 2), cex = c(.6, .4))
{
  ## Purpose: Makes a biplot with princomp() object to not show arrows
  ## ----------------------------------------------------------------------
  ## Arguments: xx is an object made using princomp()
  ## ----------------------------------------------------------------------
scores <- xx$scores[, paste("Comp", comps, sep = ".")]
loadings <- xx$loadings[, paste("Comp", comps, sep = ".")]
plot(range(scores), range(scores), xlab = "", ylab = "", xaxt = "n",
           yaxt = "n", pch = " ")
text(scores[,1], scores[,2], rownames(scores), cex = cex[1])
axis(2)
axis(1)
}

I can make part of a biplot using that function with the USArrests data:
Biplot(princomp(USArrests, cor = TRUE), c(1,2), cex = c(.6, .4))

Compare that with what we get using biplot.princomp:
biplot(princomp(USArrests, cor = TRUE), c(1,2), cex = c(.6, .4))

It seems to me that the y-values are the same in both plots, but some
sort of scaling on the x-axis is happening.  Something similar seems
to happen with the loadings as well.  

I notice in the documentation for biplot, mention is made of "... many
variations on biplots".  Would I be doing something inexcusable if I
ignored the differences I've noticed here?

TIA

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___    Patrick Connolly   
 {~._.~}          		 Great minds discuss ideas    
 _( Y )_  	  	        Middle minds discuss events 
(:_~*~_:) 	       		 Small minds discuss people  
 (_)-(_)  	                           ..... Anon
	  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.



More information about the R-help mailing list