plot.r4vn_tabscore: Plot an R4VN scorecard

plot.r4vn_tabscoreR Documentation

Plot an R4VN scorecard

Description

Draw one or all publication-oriented scorecard graphics using base R only. With which="all" (the default), every available graph is drawn in sequence; in RStudio the back/forward arrows in the Plots pane can be used to review the complete plot history. The same available graphics are embedded automatically in the HTML Viewer when the original tabscore() call used plot=TRUE.

Usage

## S3 method for class 'r4vn_tabscore'
plot(
  x,
  which = c("all", "risk", "roc", "calibration", "decision", "distribution"),
  title = NULL,
  font_family = "sans",
  ...
)

Arguments

x

A r4vn_tabscore object.

which

Plot type: all, risk, roc, calibration, decision, or distribution. all draws every plot that is available for the fitted model family.

title

Optional custom title when one plot is requested. With which="all", each plot keeps its own descriptive title.

font_family

Base-R graphics font family. Default "sans" is used to keep Viewer, browser and RStudio rendering consistent without another graphics dependency.

...

Additional arguments are reserved.

Value

For one plot, invisibly returns its plotted data. With which="all", invisibly returns a named list containing the data for every graph drawn.

Examples

set.seed(23)
d <- data.frame(
  age = rnorm(160, 50, 11),
  smoke = factor(rbinom(160, 1, .30), 0:1, c("No", "Yes"))
)
d$event <- rbinom(160, 1, plogis(-3.5 + .045*d$age + .7*(d$smoke == "Yes")))
z <- tabscore(event, c(age, smoke), data=d,
              validate="none", plot=TRUE, show=FALSE)
plot(z, which="risk")
plot(z, which="roc")

plot(z) # all available plots, one after another


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