style_roc: Add guides and annotations to a ROC plot

View source: R/style_roc.R

style_rocR Documentation

Add guides and annotations to a ROC plot

Description

Adds a diagonal guideline, minor grid lines, and optionally direct labels to ggplot objects containing a geom_roc layer.

Usage

style_roc(
  major.breaks = c(0, 0.1, 0.25, 0.5, 0.75, 0.9, 1),
  minor.breaks = c(seq(0, 0.1, by = 0.01), seq(0.9, 1, by = 0.01)),
  guide = TRUE,
  xlab = "False positive fraction",
  ylab = "True positive fraction",
  theme = theme_bw
)

Arguments

major.breaks

vector of breakpoints for the major gridlines and axes

minor.breaks

vector of breakpoints for the minor gridlines and axes

guide

logical, if TRUE draws diagonal guideline

xlab

X-axis label

ylab

Y-axis label

theme

Theme function compatible with ggplot2

Examples

D.ex <- rbinom(50, 1, .5)
fakedata <- data.frame(M1 = rnorm(50, mean = D.ex), 
   D = D.ex)
ggplot(fakedata, aes(m = M1, d = D)) + geom_roc() + style_roc()
ggplot(fakedata, aes(m = M1, d = D)) + geom_roc() + style_roc(xlab = "1 - Specificity")
ggplot(fakedata, aes(m = M1, d = D)) + geom_roc() + style_roc(theme = theme_grey)

plotROC documentation built on May 28, 2022, 1:11 a.m.