Learn R Programming

plotROC (version 2.3.1)

style_roc: 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

Run this code
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)

Run the code above in your browser using DataLab