On 21.10.2010 00:39, Alejo C.S. wrote:> Dear list, I'm trying to make a biplot, but instead of plotting the row
> number for each observation, plot a group factor.
> Example:
>
> prcomp(iris[,1:4]) -> PCA
> biplot(PCA) #this makes a nice biplot but with row names
>
> Instead of row numbers I want to plot iris[,5], which is a factor.
> I can do this:
>
> plot(PCA$x[,1], PCA$x[,2], type="n")
> text(PCA$x[,1], PCA$x[,2], labels=iris[,5], col=palette()[iris[,5]])
>
> Here I have a nice colored plot, but without the variable vectors.
> Any tip?
See ?biplot
biplot(PCA, xlabs=iris[,5])
Uwe Ligges
> Thanks a lot in advance.
>
> Alejo
>
> [[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.