r - Plot points of metaMDS -


i plot points of metamds using different symbols. categorize sites , plot points different symbols.

i have 89 sites , group them in 11 groups , plot it.

do have idea how can this?

thank much.

here simple example using base plots in vegan. there more detail in blog post on subject. key create set of plotting characters 11 groups (pchs below) , index set of characters using factor containing group membership (grps below).

require("vegan") data(dune)  set.seed(123) sol <- metamds(dune)  pchs <- 1:11 grps <- factor(sample(letters[1:11], nrow(dune), replace = true)) ## note not 11 groups included in sample ## show - have variable containing ## group membership data  plot(sol, type = "n", display = "sites") points(sol, display = "sites", pch = pchs[grps]) 

if want more automation , happy use ggplot2 package, have started new package, ggvegan you. ggvegan not on cran or r-forge @ moment you'll need build package or install using tools devtools package.

require("ggvegan") scrs <- fortify(sol) scrs <- subset(scrs, subset = score == "sites") ## ggplot doesn't more 6 groups shape grps <- factor(sample(letters[1:6], nrow(dune), replace = true)) scrs <- cbind(scrs, group = grps) ## add on group variable  ## plot ggplot(scrs, aes(x = dim1, y = dim2, shape = group, colour = group)) +    geom_point() + coord_fixed() 

for more 6 groups need specify shapes hand, via scale beyond scope of answer.

it days ggvegan , may make fortify methods accept additional vectors add fortified scores, have add grouping variable yourself.


Comments