ggrepel remove line around labels

Hugh picture Hugh · May 31, 2017 · Viewed 8.7k times · Source

How can I remove the line around geom_label_repel. Using label.size = 0 appears to have no visible effect. I could set `colour

library(ggplot2)
library(ggrepel)
ggplot(mtcars, aes(wt, mpg, color = wt)) +
  geom_point(color = 'red') +
  geom_label_repel(aes(label = rownames(mtcars)), label.size = 0, fill = "white") +
  theme_classic(base_size = 16)

Entering a geom_text_repel after a blank geom_label_repel occasionally works, but is not reliable: the boxes may appear in a different location to the text.

enter image description here

Answer

Hugh picture Hugh · Jun 25, 2017

As eipi10 noted in the comment, set label.size=NA:

library(ggplot2)
library(ggrepel)
ggplot(mtcars, aes(wt, mpg, color = wt)) +
  geom_point(color = 'red') +
  geom_label_repel(aes(label = rownames(mtcars)), label.size = NA, fill = "white") +
  theme_classic(base_size = 16)