如何删除geom_label_repel
周围的行。使用label.size = 0
似乎没有可见效果。我可以设置颜色
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)
在空白的
geom_text_repel
之后输入geom_label_repel
有时可以,但是并不可靠:这些框可能出现在与文本不同的位置。最佳答案
正如eipi10在评论中指出的那样,设置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)
关于r - ggrepel删除标签周围的线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44275000/