1
I’m trying to create a polygon but I can’t get it filled and complete.
geral<-read.csv2("flora.csv", header=TRUE, stringsAsFactors = T);head(geral)
comgeral = geral[,4:ncol(geral)]
m_comg = as.matrix(comgeral)
set.seed(123)
nmdsg = metaMDS(m_comg, distance = "bray");nmdsg
data.scoresg = as.data.frame(scores(nmdsg))
data.scoresg$rio = geral$rio
data.scoresg$tipologia = geral$tipologia
nmdsg= ggplot(data.scoresg, aes(x = NMDS1, y = NMDS2, col=rio)) + geom_polygon(data.scoresg, aes (fill = rio , group = rio))
geom_point(size = 3, aes( shape = tipologia, colour = rio))+ stat_ellipse() +
theme(axis.text.y = element_text(colour = "black", size = 10, face = "plain"),
axis.text.x = element_text(colour = "black", face = "plain", size = 10),
legend.text = element_text(size = 10, face ="plain", colour ="black"),
legend.position = "right", axis.title.y = element_text(face = "plain", size = 10),
axis.title.x = element_text(face = "plain", size = 10, colour = "black"),
legend.title = element_text(size = 10, colour = "black", face = "plain"),
panel.background = element_blank(), panel.border = element_rect(colour = "darkgray", fill = NA, size = 1.2),
legend.key=element_blank()) +
labs(x = "NMDS1", colour = "Área", y = "NMDS2", shape = "Tipologia florestal") +
scale_colour_manual(values = c("green","purple"))
nmdsg
Welcome to Stackoverflow! Unfortunately, this question cannot be reproduced by anyone trying to answer it. Please take a look at this link (mainly in the use of function
dput
) and see how to ask a reproducible question in R. So, people who wish to help you will be able to do this in the best possible way.– Marcus Nunes
Complementing the @Marcus-Unes comment, if your question does not depend on your data specifically, you can use any of the datasets included in the example R. You can, for example, use the set
varespec
package vegan. Taking advantage of the subject, include at the beginning of the code posted the libraries you are using(ggplot2 and vegan), just like tags. And remove the "rstudio" tag, since your question is not about it.– Carlos Eduardo Lagosta