3

I would like to remove the second part of the legend but maintain the colours in the plot. My code is below (any help greatly appreciated):

nmds.gplot<-ggplot(nmds2,aes(x=nmds1,y=nmds2))
nmds.gplot + aes(shape=factor(yr)) +
      geom_point (aes(colour=factor(Trt)),size=4) +
      theme_bw() +
      theme(panel.grid.major=element_blank(),panel.grid.minor=element_blank()) +
      scale_x_continuous(name="NMDS Axis 1") +
      scale_y_continuous(name="NMDS Axis 2") +
      theme(axis.title.x = element_text(size=16)) +
      theme (axis.title.y=element_text(size=16)) +
      theme (axis.text.y  = element_text(size=14)) +
      theme (axis.text.x  = element_text(size=14)) +
      geom_vline (xintercept=0, linetype = "dotted") +
      geom_hline (xintercept=0, linetype = "dotted")

enter image description here

Anand Roopsind
  • 581
  • 2
  • 8
  • 11
  • 2
    Did you bother to google "ggplot remove legend"? – Henrik Aug 21 '15 at 21:48
  • 2
    well it's not simply remove legend - but remove part of the legend; if you marked it as duplicate it would have been helpful to actually link to where it has been addressed. – Anand Roopsind Aug 21 '15 at 22:39
  • 2
    Hi Anand, could you explain why the question linked by Henrik does not work for you. `ggplot(mtcars, aes(x=wt, y=mpg, shape=factor(cyl))) + geom_point (aes(colour=factor(gear))) + guides(colour=FALSE)` would seem to do what you want. If not can you please update your question with a reproducible example. Thanks – user20650 Aug 21 '15 at 23:18

0 Answers0