On Wed, 2010-12-08 at 13:54 +0530, Sinu P wrote: > Hi, > > I have used Vegan to construct an NMDS ordination plot. I plotted sites of > three forest types with the site number in it. My reviewer has asked me to > use different symbols for each of the forest types. > Can anyone send me how I can do this in R in simple steps. I have used the > options like ordiplot, sel and pl syntaxes that are not working for the > question that I asked for. > > Best, > Sinu
The commonly used procedure is to set up a vector of colours or symbols you want to use, one per group. Then set up a variable that contains the group identifier, as a factor. We then index the colours or symbols vector with our grouping factor to produce the correct length and specification of parameters col or pch for the plot. Here is an example: require(vegan) data(varespec) ## Ordination ord <- metaMDS(varespec) ## Dummy forest types, indicator ## stored as a factor ftypes <- gl(3, nrow(varespec)/3) ## or via something like ftypes <- factor(rep(paste("Type", 1:3), each = 8)) ## plot the data plot(ord, display = "sites", type = "n") ## add the points coloured by ftype ## 1) specify colours wanted for groups vcols <- c("red","green","blue") ## or 1) specify symbols for groups vpch <- c(16,17,18) ## 2) add points using ftypes to index vcols points(ord, col = vcols[ftypes], pch = vpch[ftypes]) To see what is being done, try: > vcols[ftypes] [1] "red" "red" "red" "red" "red" "red" "red" "red" "green" [10] "green" "green" "green" "green" "green" "green" "green" "blue" "blue" [19] "blue" "blue" "blue" "blue" "blue" "blue" HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ______________________________________________ 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.