why R did not recognise month of "January" in my plot

I wanna make one plot, but there is no 'January' displayed in the legend, I have no idea which place is wrong in my code!!! Thanks all!!!

ZHnMDS1 = metaMDS(data)
ZHnMDS1_scores = as.data.frame(scores(ZHnMDS1))
ZHnMDS1_scores$grp = MB$Month
ZHfind_hull <- function(df)
  df[chull(df$NMDS1, df$NMDS2),]
ZHhulls <- ddply(ZHnMDS1_scores, "grp", ZHfind_hull)
ZHnMDS_scores = read.csv("Desktop//ZHnMDS_scores.csv")
ggplot(ZHhulls, aes(NMDS1, NMDS2)) +
  geom_polygon(data = ZHhulls,
                 x = NMDS1,
                 y = NMDS2,
                 fill = factor(grp),
                 group = grp
               alpha = 0.09) + #fill change color
    data = ZHnMDS1_scores,
    aes(x = NMDS1, y = NMDS2),
    size = 0.8,
    alpha = 0.1
  ) +
  geom_path(aes(x = NMDS1, y = NMDS2, color = factor(TEAM)), ZHnMDS_scores) +
  #color change color
  theme_bw() +
    panel.background = element_blank(),
    panel.grid.major = element_blank(),
    #remove major-grid labels
    panel.grid.minor = element_blank(),
    #remove minor-grid labels
    plot.background = element_blank()
  ) +
  scale_fill_discrete(breaks = c(
  )) + labs(color = "Final", fill = "Month")

Could you please turn this into a self-contained reprex (short for reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.


If you've never heard of a reprex before, you might want to start by reading the tidyverse.org help page. The reprex dos and don'ts are also useful.

What to do if you run into clipboard problems

If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.

reprex::reprex(input = "fruits_stringdist.R", outfile = "fruits_stringdist.md")

For pointers specific to the community site, check out the reprex FAQ.

1 Like

Does the value "January" show up in your data?

1 Like

If I put Janurary, R present the data in the plot!!!
BUT Janurary is wrong, January is right!!!!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.