sinhrks / ggfortify

Define fortify and autoplot functions to allow ggplot2 to handle some popular R packages.
Other
527 stars 65 forks source link

Added methods for ROCR performance objects #145

Closed austin3dickey closed 7 years ago

austin3dickey commented 7 years ago

Added methods for fortify and autoplot to support performance objects from the ROCR package.

terrytangyuan commented 7 years ago

Thanks Austin! Could you paste some example plots here?

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.1%) to 93.211% when pulling 92ba237cd06cd4e5d4efcc0692f031b8c9a54717 on austin3dickey:fortifyROC into 8fb5bf30b69a8b18e3c9ed0f0c01eda84155961d on sinhrks:master.

austin3dickey commented 7 years ago

Example plots:

library(ROCR)
data("ROCR.xval")
pred <- ROCR::prediction(ROCR.xval$predictions,
                         ROCR.xval$labels)
for (perfObj in c(performance(pred, 'acc'),
                  performance(pred, 'tpr', 'fpr'),
                  performance(pred, 'auc'))) {
  plot(perfObj, main = 'Base plotter', colorize = TRUE)
  autoplot(perfObj, main = 'autoplot')
}

image image image image Base plot for the third object gets this error: Error in .plot.performance: Performance object cannot be plotted. image

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.2%) to 93.306% when pulling 9ee0021f36b4a01864e2f4a9f2742c0efb170688 on austin3dickey:fortifyROC into 8fb5bf30b69a8b18e3c9ed0f0c01eda84155961d on sinhrks:master.

terrytangyuan commented 7 years ago

Thanks!! Merged!