2017-07-22 52 views
0

我正在繪製ROC曲線,並根據截斷水平對它進行了着色。然而,圖例中的數字擁有比所需的更多的小數位,並且與圖例的整體大小相比非常大。我想要一個十進制數字,更多的值,更小的文字和更大的圖例。但我不知道如何控制這些參數。我的代碼如下:在ggplot中控制文本的格式和圖例的總體大小 - 連續顏色

ggplot(Stats1_glm, aes(x = (1 - Specificity), y = Sensitivity, colour = Cut_Off)) + 
    geom_line(size = 2) + theme_economist() + ggtitle("ROC Curve") + 
    scale_color_gradient(low="blue", high="red") + xlab("False Alarm (1 - Specificity)") + ylab("Sensitivity (Recall)") 

enter image description here

你的建議將不勝感激。

回答

1

你可以嘗試添加這對您的情節:

... + theme(legend.position = 'bottom', # Place the legend at the bottom 
     legend.justification = c(1,0), # Position it at the right 
     legend.key.width = unit(2.5, 'lines')) # Increase its width to 2.5 lines 
相關問題