2017-07-22 64 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 
相关问题