plot.r4vn_diag: Plot an R4VN diagnostic analysis

View source: R/tabdiag.R

plot.r4vn_diagR Documentation

Plot an R4VN diagnostic analysis

Description

Draw ROC curves and/or sensitivity-specificity curves over empirical thresholds from an object returned by tabdiag().

Usage

## S3 method for class 'r4vn_diag'
plot(
  x,
  what = c("roc", "cutoff", "both"),
  color = NULL,
  lty = 1,
  line_width = 2,
  legend = TRUE,
  legend_position = "bottomright",
  auc = TRUE,
  diagonal = TRUE,
  diagonal_lty = 2,
  grid = FALSE,
  xlim = c(0, 1),
  ylim = c(0, 1),
  xlab = "1 - Specificity",
  ylab = "Sensitivity",
  main = NULL,
  cutoff_mark = TRUE,
  cutoff_legend = TRUE,
  cutoff_xlab = "Threshold",
  cutoff_ylab = "Probability",
  cutoff_main = NULL,
  file = NULL,
  width = 7,
  height = 7,
  res = 300,
  bg = "white",
  font_family = NULL,
  cex_axis = 1,
  cex_lab = 1,
  cex_main = 1,
  bty = "l",
  ...
)

Arguments

x

An object returned by tabdiag().

what

"roc", "cutoff", or "both".

color

Optional vector of line colors. Defaults to a distinct base-R qualitative palette.

lty

ROC line type(s).

line_width

ROC/cutoff line width(s).

legend

Logical; show the ROC legend.

legend_position

Base-graphics legend position, default "bottomright".

auc

Logical; append AUC to ROC legend labels.

diagonal

Logical; draw the no-discrimination diagonal.

diagonal_lty

Line type for the no-discrimination diagonal.

grid

Logical; draw a light reference grid.

xlim, ylim

ROC axis limits. Values are clamped to c(0, 1). Defaults are exactly c(0, 1) so the ROC axes never extend below 0 or above 1.

xlab, ylab

ROC axis labels.

main

Optional ROC title.

cutoff_mark

Logical; mark selected cutoffs with vertical reference lines on cutoff plots.

cutoff_legend

Logical; show sensitivity/specificity legend on cutoff plots.

cutoff_xlab, cutoff_ylab

Cutoff-plot axis labels.

cutoff_main

Optional cutoff-plot title. When multiple markers are plotted, the marker label is appended automatically.

file

Optional graphics filename. Supported extensions are .png, .jpg/.jpeg, .tif/.tiff, .pdf, and .svg. For what = "both", save the ROC and cutoff plots separately with two calls to plot().

width, height

Figure width and height in inches when file is used. Defaults are 7 and 7.

res

Raster resolution in dpi for PNG/JPEG/TIFF output. Default 300.

bg

Graphics-device background color. Default "white".

font_family

Optional base-graphics font family, for example "Arial", when available on the current system.

cex_axis, cex_lab, cex_main

Text-size controls for axes, labels, title.

bty

Box type passed to base graphics.

...

Additional arguments passed to the initial base plot() call.

Value

Invisibly returns x.


R4VN documentation built on Sept. 30, 2026, 5:13 p.m.