Hi Listers,

This has a simple answer but it has been eluding me nonetheless.

I have been building a PCA plot from scratch with the ability to plot
predefined groups in different colors. This has worked fine but when I try
to get a polygon drawn around each of the groups it is not recognising my
colour file correctly and is only printing the first colour in the
file....code is below

 site.codings <-
c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,5,4,4,4,4,4,3,3,3,6,6,6,6,6,6,6,6,5,5,5,5)
> names(site.codings) <- c( "WM1", "WM2", "WM3", "NM1", "NM2", "NM3", "KH1",
"KH2", "KH3", "LM1" ,"LM2" ,"LM3", "DB1" ,"DB2" ,"DB3", "DM1" , "DM2" ,
"DM3" , "FI1",  "FI2",  "BKI1", "BKI2", "BKO1", "BKO2", "BKO3",
"SUR1","MI1","MI2","MI3","BHE1","BHE2","BHE3","BHW1","BHW2","BHW3","HAL1","HAL2","HAL3","HAL4","HAL5","HAL6","HAL7","DOH1","DOH2","DOH3","DOH4","DOH5")
> fish.pca <-rda(fish.sqrt.h)
> fish.site <- scores(fish.pca,display="sites",scaling=3)
> fish.spp <-
scores(fish.pca,display="species",scaling=3)[omanfish.mrt.indval$pval<=0.05,]
> graph <- plot(fish.pca,display=c("sites","species"),type="n",scaling=3)
> plotcolor <-
c("red","green","blue","aquamarine","magenta","yellow")[site.codings]
> points(fish.site,pch=21,bg=plotcolor,cex=1.2)

#up to this point all works well but when I try to draw the polygons I cant
get the lines to colour code the same way as the points did

> ordiellipse(graph,site.codings,kind="sd",conf=0.90,draw="polygon")

I see there is a command called show.groups but I cant work out how to use
it to access the plotcolor file.

Any help appreciated.


-- 
Andrew Halford Ph.D
Associate Research Scientist
Marine Laboratory
University of Guam
Ph: +1 671 734 2948

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to