I’m playing with the ROC function in the Epi package, whose documentation specifies that you can pass graphical parameters to the plot function. By default, ROC produces a grayscale graph. I’m trying to color only the ROC curve itself (the jagged line) red.
Here’s what I tried:
x = rnorm(100)
y = c(rep(0,50), rep(1,50))
library(Epi)
par(col="red"); ROC(form = y~x, plot="ROC")
This creates a strange graph with inconsistent coloring. The par documentation does describe some specific methods like col.lab and col.axis to color specific graphical elements, but doesn’t include a parameter for the main line color.
I have to think this basic question must have been addressed elsewhere, but so far haven’t had luck searching the R documentation and Google.
For your specific case, if you want to modify the function
ROCto suit your needs, you can do the following. TypeROCat the console to see the code forROC. Copy and paste it into a file and assign it a new name, likeROC2. Look for the following code:You’ll want to pass
col = "red", or some such, in thelinescall. For instance you could add amycolargument to the function itself and then change that one line to:Also, as I noted below, you will also have to change all instances of
ROC.tictoEpi:::ROC.tic.