2017-05-31 350 views
0

如何刪除geom_label_repel周圍的線條。使用label.size = 0似乎沒有明顯的效果。我可以設置`顏色ggrepel刪除標籤周圍的線條

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偶爾的工作,但並不可靠:框可能會出現在不同的位置的文本。

enter image description here

+0

'label.size = 0'擺脫了邊框的,當我運行代碼。 – eipi10

+0

它們可見,但非常小。 (例如,當我將它保存爲PDF時,它們在一些觀衆中清晰可見。) – Hugh

+1

如果您執行'label.size = NA',那麼該怎麼辦? – eipi10

回答

0

正如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)