Wrong value of 1-specificity when drawing ROC curve when setting "legacy.axes = TRUE"

33 Views Asked by At

I had drawn a ROC curve using the following codes:

roc_plot <- function(data, x, y){
    fit <- roc(response = data[[x]], predictor = data[[y]])
    plot(fit,
         print.auc = T,
         print.auc.x=0.2, print.auc.y= 0, 
         print.thres = T, 
         print.thres.cex = 1, 
         legacy.axes = T, 
         grid = T, 
         auc.polygon = T,
         lwd= 2, # ROC 線粗
         identity.lty =2, 
         smooth= T, 
         main="ROC Curve",col="#1c61b6")
}

roc_M2BP_plot <- roc_plot(sheet_4, "HCC", "M2BP")

At first, it looks normal

enter image description here

However, one day, it became like this

enter image description here

Note that the threshold, AUROC were all correct.

Actually, the plot is also correct if I set legacy.axes = F

enter image description here

What is the problem? I thought I didn't change the Excel data.

0

There are 0 best solutions below