How do I convert an roc object to a grob? I have multiclass roc graphs that need to be in one panel and have tried par, grid.arrange, ggpubr, etc

66 views Asked by At

I've tried using par, plot, cowplot, grid.arrange, ggpubr and none of these work. Additionally, the legend doesn't appear or is too big.

library(ggplot2)

p1<-plot(rocmenv, col = 1, lty = 2)#black dashed
plot(rocmenvnb, col = 2, lty = 3, add = TRUE)#red dotted
plot(rocmenvnn, col=3, lty=4, add=TRUE)#green dotdash
plot(rocmenvdt, col=4, lty=5, add=TRUE)# blue longdash

## Add Legend
legend("bottomright",
   legend = c("Random Forest: AUC 92%", "Naive Bayes: AUC 97%", "Neural Network:AUC       100%", "Decision Tree:AUC 64%"), 
   col = c("black", "red", "green", "blue"),
   lty = c(2, 3, 4, 5), xpd = TRUE, cex = 0.6)#black dashed

p2<-plot(rocbombv, col = 1, lty = 2)#black dashed
plot(rocbombvnb, col = 2, lty = 3, add = TRUE)#red dotted
plot(rocbombvnn, col=3, lty=4, add=TRUE)#green dotdash
plot(rocbombvdt, col=4, lty=5, add=TRUE)# blue longdash

## Add Legend
legend("bottom", 
   legend = c("Random Forest: AUC 88%", "Naive Bayes: AUC 93%", "Neural Network:AUC 100%", "Decision Tree:AUC 75%"), 
   col = c("black", "red", "green", "blue"),
   lty = c(2, 3, 4, 5), xpd = TRUE)
0

There are 0 answers