geom_polygon_auc.roc: Add an AUC polygon to a ggroc plot

View source: R/geom_polygon_auc.R

geom_polygon_aucR Documentation

Add an AUC polygon to a ggroc plot

Description

EXPERIMENTAL - Add an AUC polygon to a ggroc plot.

Usage

## S3 method for class 'auc'
geom_polygon_auc(data, legacy.axes = FALSE, ...)
## S3 method for class 'roc'
geom_polygon_auc(data, ...)
## S3 method for class 'smooth.roc'
geom_polygon_auc(data, ...)

Arguments

data

a roc object from the roc function, same as the one used to build the ggroc initially.

legacy.axes

must match the value given to ggroc.

...

additional aesthetics for geom_polygon to set: alpha, colour, linetype and linewidth.

Details

This is highly experimental and may change in the future.

See Also

ggroc

Examples


# Create a ROC curve:
data(aSAH)
roc.s100b <- roc(aSAH$outcome, aSAH$s100b)
roc.s100b.percent <- roc(aSAH$outcome, aSAH$s100b, percent = TRUE)

ggroc(roc.s100b) + geom_polygon_auc(roc.s100b$auc)

# legacy.axes must be repeated
ggroc(roc.s100b.percent, legacy.axes=TRUE) + geom_polygon_auc(roc.s100b.percent, legacy.axes=TRUE)

# Partial AUCs
auc.s100b.partial.sp <- auc(roc.s100b, partial.auc = c(0.9, 1))
auc.s100b.partial.se <- auc(roc.s100b, partial.auc = c(0.8, 0.9), partial.auc.focus="se")

ggroc(roc.s100b) + geom_polygon_auc(auc.s100b.partial.sp)
ggroc(roc.s100b) + geom_polygon_auc(auc.s100b.partial.se)


pROC documentation built on Aug. 8, 2025, 6:28 p.m.