0
df <- data.frame(x=rep(1:10,2), y=c(1:10,11:20), 
             group=c(rep("a",10),rep("b",10)))

g <- ggplot(df, aes(x=x, y=y, group=group))
g <- g + geom_line(aes(colour=group))
g <- g + geom_point()+geom_text(aes(label = y,vjust = 1, size=4))

Code as above

First I have read some answers and know how to remove the legend in ggplot, but now I have no ideal about the name of following plot text legend, the "4a4" part, and how to remove it. I have tried to add "guide = F" in geom_text or " p + guides(label = F)", but it still doesn't work.

so how to remove the text legend?

the plot

Sathish
  • 12,453
  • 3
  • 41
  • 59
pauke Huang
  • 71
  • 1
  • 8
  • `p <- ggplot(data = pm112m, aes(month, growth, group = variable, color = variable))+ geom_line()+ geom_point()+ geom_text(aes(label = paste0(sprintf("%.1f", round(growth,4)*100), "%")), vjust = 0.2, size=4, guide = F)` – Sathish Apr 01 '17 at 09:05
  • Thanks for the reply!! But it seems not work still. In my case, the extra legend is not from geom_poin, but from geom_text. – pauke Huang Apr 01 '17 at 09:24
  • `geom_text(aes(label = y),vjust = 1, size=4)` – Sathish Apr 01 '17 at 10:45

0 Answers0