Adding a legend to a plot

Viewed 3344

How to add a legend to the following code that is located outside the plot area. Here is a prodicble code:

par(pty="s")
library(ROCR)
data(ROCR.simple)
pred <- prediction( ROCR.simple$predictions, ROCR.simple$labels )
pred2 <- prediction(abs(ROCR.simple$predictions + 
                    rnorm(length(ROCR.simple$predictions), 0, 0.1)), 
            ROCR.simple$labels)
perf <- performance(pred, "tpr", "fpr" )
perf2 <- performance(pred2, "tpr", "fpr")
# Plot pred 1
plot(perf, col="red")
# plot pred 2
plot(perf2, add = TRUE, col="blue")

Any suggestions would be appreciated. Thank you!

1 Answers
Related