I am building and customizing an ROC curve using ggplot in R. I am almost done except 2 challenges.
The abline I am adding for some reason extends beyond 0 and 1. How to restrict this? The line should start from origin and go to (1,1)
How do I show the decimal labels as percentages?
Code I wrote so far:
ggplot(roc, aes(x=fpr, ymin=0, ymax=tpr)) +
geom_ribbon(alpha=0.2) +
geom_line(aes(y=tpr)) +
ggtitle(paste0("ROC Curve, AUC=",auc)) +
xlab("Cumulative % Goods")+
ylab("Cumulative % Bads")+
geom_abline(intercept=0, slope = 1, color="red", linetype="dashed")+
theme_classic()
I also tried adding scale_y_continuous(labels='percent')
but then it gives me an error "breaks and labels must have the same length"