0 votes
1 view
in R Programming by (5.3k points)

How can I remove the letter 'a' from the legend generated by this code? If I remove the geom_text, then the 'a' letter will not show in the legend. I want to keep geom_text, though.

ggplot(data = iris, aes(x = Sepal.Length, y=Sepal.Width, shape = Species, colour = Species)) + 

   geom_point() + 

   geom_text(aes(label = Species))

1 Answer

0 votes
by (25.3k points)

You can set the show.legend argument in the geom_text function to FALSE in order to avoid the “a” in the legend.i.e.,

 

ggplot(data = iris,

       aes(x = Sepal.Length, y = Sepal.Width, colour = Species, shape = Species, label = Species)) + 

  geom_point() +

  geom_text(show.legend = FALSE)

 

Output:

 

image

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 4, 2019 in R Programming by leealex956 (6.5k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...