pROC ROC curves remove empty space

后端 未结 3 979
故里飘歌
故里飘歌 2020-12-03 23:47

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:

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 00:29

    An other answer, if you don't mind to have distorted axis, is to use the asp parameter. By default it is set to 1, ensuring both axis have the same scale and the ROC curve is squared*, but you can turn it off with asp = NA:

    library(pROC)
    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, asp = NA)
    

    * Having a squared ROC curve is important if you want to interpret it visually. For instance, you may want to compare several local maximas by their distance to the diagonal: you can only do that if the two axis have the same scale. So if you want to do that make sure to follow my other answer.

提交回复
热议问题