You did not provide a reproducible example, but you should be able to get what 
you want as follows:

library(vegan)
data(dune)
data(dune.env)

lbls <-as.integer(dune.env$Management)
grps <- levels(dune.env$Management)
ngrps <- length(grps)

example_dune <- metaMDS(dune, distance="bray", k=2)
ordiplot(example_dune, display="species", type="n")
points(example_dune, col="black", pch = lbls)
ordihull(example_dune, dune.env$Management, scaling = "symmetric", lty=lbls)
# Optionally add a legend
legend("topright", grps, pch=1:ngrps, lty=1:ngrps)

# However if you want to position the labels, try this
grp.lbls <- locator()
# Click where you want each label to appear.
# The pch symbols are circle, triangle, plus, X
# click where you want the label to appear for each group
# in that order and then click stop (upper left corner)
# of the window.
text(grp.lbls, grps)

Or just eyeball the coordinates. Once you have them where you want them, save 
them with dput() and include them in your script file (assuming you are 
planning to plot to a print device later).

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Sibylle Stöckli
Sent: Friday, December 9, 2016 12:20 PM
To: r-help@r-project.org
Subject: [R] vegan NMDS labels

Dear R users

Does anybody know how it may be possible to plot the labels of a ordihull 
function separately (in R vegan)? We have studied the bee community in 5 
different habitat types. As you see from the code, we use different point types 
(pch) and line types (lty). This is only possible if we change the habitat from 
character to integer. However, we prefer to show the labels as characters and 
not as integers 1-5? Furthermore, does anybody now how to plot the labels at 
the border and not in the centroid of the polygon (due to overlapping polygons 
it is not easy to assign them to the right polygon)?

Many thanks
Sibylle

### NMDS code ####
example_NMDS=metaMDS(community_matrix, # Our community-by-species matrix
                     distance = "bray", k=2) # The number of reduced dimensions
stressplot(example_NMDS)
ordiplot (example_NMDS, display = 'species', type = 'n', xlim=c(-0.5,0.5), 
ylim=c(-0.7,0.7))
HabTyp<-as.integer(S1$H_Aggregat1) # 5 different habitats. 
points (example_NMDS, col="black", pch = HabTyp)
for (i in unique (HabTyp)) ordihull (example_NMDS, groups = HabTyp, show.group 
= i, draw = 'polygon', label=T, cex=1.5, lty=i)


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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