I am attempting to add 95% confidence ellipse to an NMDS plot using the vegan package and function "ordiellipse" and keep getting the same error message. The ordination looks like this:
microcosm_nmds <- ordinate(physeq = physeq_bac1, method = "NMDS", distance = "bray")
plot_ordination(
physeq = physeq_bac1,
ordination = microcosm_nmds,
color = "day",
shape = "location",
title = "NMDS of Microcosm bacterial Communities"
) +
scale_color_manual(values = c("red", "#ffae19",
"#4daf4a", "#1919ff", "darkorchid3", "magenta")
) +
geom_point(aes(color = day), alpha = 0.7, size = 4) +
geom_point(colour = "grey90", size = 1.5)
The code for the ellipse I am trying to use is:
ordiellipse(microcosm_nmds, groups = "day", display = "sites", kind = "sd", conf = 0.95, col = "black", w = NULL)
When doing this, I keep getting an error that says "Error in cov.wt(X, W) : 'x' must contain finite values only" and I'm not sure why. There are no NAs or missing values in the data, and the ordination works fine. I can only guess it has something to do with sample weights? But I'm not sure. Any help at all would be much appreciated.
Thanks!