Search code examples
rplotpar

R: plotROC main title cannot be changed from default


I use the plotROC from hmeasure-package to (try to) plot an ROC curve. I get a plot like shown below. The code I used is:

require(hmeasure)
predictions_LIMO <- data.frame(df)  
h_LIMO <- HMeasure(mydata$churn, predictions_LIMO) 
plotROC(h_LIMO,which=1)

If I try to customize the main title, I get the two titles overlapping each other, like shown in the lower picture. The additional code is:

title("ROC curve for LIMO4 to LIMO8")

Is there a way to get rid of the automatically assigned title? I tried main=0 but received unused argument (main = 0).

In the ?plotROC I did not find anything about that.

Thanks for any advice (maybe also on different packages that I can use to circumvent the problem)!

enter image description here

enter image description here


Solution

  • As @joran said, it's hard-coded. Here's a quick hack if you don't want to mess with the plotROC function. You can "cover" the existing title with a white rectangle and then add your own title. For example:

    # Adjust location of rectangle as needed. These coordinates should work
    # for the graph you posted.
    rect(0, 1.1, 1, 1.7, xpd=TRUE, col="white", border="white")
    title("My Title")