sachsmc / plotROC

Interactive ROC plots with ggplot + d3.js.
http://sachsmc.github.io/plotROC
Other
84 stars 13 forks source link

Jittering cutoff points in geom_roc() #83

Open alexflaris opened 2 weeks ago

alexflaris commented 2 weeks ago

Hi there,

Thank you for creating the plotROC package. I am trying to get the cutoff values off of the ROC curve (even in the vignette, the numbers seem to overlap the curve, e.g. in the figure below the line: ggplot(test, aes(d = D, m = M1)) + geom_roc(n.cuts = 5, labelsize = 5, labelround = 2))), but I am not seeing that as a feature for geom_roc. Is there a plan to include this possibility in the future?

Thank you, Alex

sachsmc commented 1 week ago

Hi Alex,

I did have plans to try using ggrepel to make the labels, but haven't worked on it yet. In the meantime you can try using the hjust, vjust, and angle arguments in the geom_roc function. Here is an example, play around with the values until it looks good for your example:

library(plotROC)
D.ex <- rbinom(50, 1, .5)
rocdata <- data.frame(D = c(D.ex, D.ex), 
                      M = c(rnorm(50, mean = D.ex, sd = .4), rnorm(50, mean = D.ex, sd = 1)), 
                      Z = c(rep("A", 50), rep("B", 50)))

ggplot(rocdata, aes(m = M, d = D)) + geom_roc(hjust = -.2, vjust = 0.4, angle = 45)