Three points missing in NMDS graph

43 Views Asked by At

see image of some of my data x12 locations x26 macroinvertebrates

Hello, this is my first time producing an NMDS graph. I am missing three sites from the final plot (Creek B1,B2,B3).
I looked at the scores to see there was four with the exact same scores- this seems suspicious to me ? This data was collected by students though and with not much rigour so may be a combination of sample error and my code.

Here is my code:

library("vegan")
library(readxl)
rivers_catchement <- read_excel("rivers_catchement.xlsx", 
   sheet = "Sheet1")

### *Step 1. subset data which contains values:*

data_1<-rivers_catchement[,2:26]

### *Step 2. subset data contains locations:*
data_2<-rivers_catchement[1]

set.seed(3)
library("vegan")
NMDS<-metaMDS(data_1, distance= "bray")

NMDS$stress

2 0.07057647 (stress output)

set.seed(3)
library("vegan")
library("ggplot2")
scores<-scores(NMDS, display="site")

scores <- cbind(as.data.frame(scores), Habitat = data_2$Habitat)
centroids <- aggregate(cbind(NMDS1, NMDS2) ~ Habitat, data = scores, FUN = mean)
seg <- merge(scores, setNames(centroids, c('Habitat','oNMDS1','oNMDS2')),
             by = 'Habitat', sort = FALSE)

ggplot(scores, aes(x = NMDS1, y = NMDS2, colour = Habitat))+
scale_color_manual(values=c("seagreen4", "olivedrab", "palegreen3",
                              "darkcyan", "cornflowerblue", "deepskyblue3",
                              "coral1", "sienna3","brown2", "indianred3",
                              "maroon", "palevioletred"))+
  geom_segment(data = seg,
               mapping = aes(xend = oNMDS1, yend = oNMDS2)) + 
  geom_point(data = centroids, size = 4) +                    
  geom_point() + 
 
   geom_text(label= data_2$Habitat, 
    nudge_x = 0.10, nudge_y = 0.05, 
    check_overlap = T)+
  ggtitle("NMDS To Represent Macroinvertebrate Assembleges 
          Across Sites Within Leaf Litter")+
  theme(plot.title = element_text(hjust = 0.5), 
        text = element_text(family = "Times New Roman"))


If i set check_overlap = F I believe all the points are there but it is difficult to read. see here

Any tips on how to improve would help Thanks in advance for the help!

0

There are 0 best solutions below