pROC ROC曲线消除空白 [英] pROC ROC curves remove empty space

查看:307
本文介绍了pROC ROC曲线消除空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用pRoC绘制ROC曲线. 但是由于某种原因,x轴的两侧都有多余的空白空间,因此我无法使用xlim将其删除.一些示例代码:

I want to draw ROC curves with pRoC. However for some reason there is extra empty space on either side of the x-axis and I cannot remove it with xlim. Some example code:

library(pROC)
n = c(4, 3, 5) 
b = c(TRUE, FALSE, TRUE) 
df = data.frame(n, b) 
rocobj <- plot.roc(df$b, df$n, percent = TRUE, main="ROC", col="#1c61b6", add=FALSE)

我尝试了pROC帮助文件,但这并没有真正帮助我.更让我感到困惑的是,Y轴看起来还不错...

I tried the pROC help file, but that doesn't really help me. Even more puzzling is to me that the Y-axis is OK looking...

非常感谢您的帮助!

推荐答案

确保绘图设备为正方形,并调整边距,以使顶部+底部==左侧+右侧:

Make sure the plotting device is square and adjust the margins so that top + bottom == left + right:

library(pROC)
png("test.png", width = 480, height = 480)
par(mar = c(4, 4, 4, 4)+.1)
n = c(4, 3, 5) 
b = c(TRUE, FALSE, TRUE)
rocobj <- plot.roc(b, n, percent = TRUE, main="ROC", col="#1c61b6", add=FALSE)
dev.off()

这篇关于pROC ROC曲线消除空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆