How to identify the point characters in the "pch = as.numeric" command?

1k views Asked by At

I'm trying to make an NMDS plot, and so far it is working out really well, but my problem is: I have three types of Forest: A, B, and C, and the command pch = as.numeric(env$Forest) creates three kinds of point characters, but I don't know which point represents which Forest type.

I tried to add each forest type one after the other but I failed :( I would be really happy if someone could help me along! Thank you!

This is my plot command:

fig <- plot(result1, type = "none")
points(fig, "sites", pch = as.numeric(env$Forest))
text(fig, "species", font=c(2), cex=c(0.75))
plot(fit, p.max = 0.05, col = "darkgrey", font=c(2), cex=c(0.75))

This is the beautiful graph I get:

NMDS-Plot

1

There are 1 answers

0
G5W On BEST ANSWER

Since you do not provide data, this is untested, but I believe that what you need is

legend("topleft", legend = levels(env$Forest), pch = unique(as.numeric(env$Forest)))