Skip to contents

Set Up a Confusion Plot Configuration

Usage

setup_ConfusionConfig(
  reference = "reference",
  predicted = "predicted",
  count = "n",
  panel = NULL,
  classes = NULL,
  show_metrics = TRUE,
  digits = 2L,
  ncol = 2L,
  correct_color = "#0F6A66",
  incorrect_color = "#BE2E5F",
  low_color = NULL,
  summary_color = NULL,
  font_size = 12,
  xlab = "Predicted",
  ylab = "Reference",
  title = NULL,
  dat_path = NULL,
  origin = NULL,
  writer = NULL
)

Arguments

reference

Character: Column containing reference class labels.

predicted

Character: Column containing predicted class labels.

count

Character: Column containing nonnegative integer frequencies.

panel

Optional Character: Optional panel-label column; unset draws one matrix.

classes

Optional Character vector: Ordered class labels shared by every panel; unset preserves first appearance.

show_metrics

Logical: Show per-class rates, accuracy, and balanced accuracy.

digits

Integer: Decimal places for rates in cells and hover text.

ncol

Integer: Maximum number of panels per row.

correct_color

Character: Six-digit hex color at unit fraction for correct predictions.

incorrect_color

Character: Six-digit hex color at unit fraction for incorrect predictions.

low_color

Optional Character: Six-digit hex color at zero row fraction; unset uses the active theme background.

summary_color

Optional Character: Six-digit hex background for metric cells; unset uses a faint neutral tint of the active theme background.

font_size

Numeric: Preferred cell-label font size in pixels. Constrained surfaces reduce text to fit, down to 8 pixels. Long class labels wrap and column labels rotate when needed. Increase figure dimensions if labels and metrics cannot fit without overlap.

xlab

Character: Predicted-class axis label.

ylab

Character: Reference-class axis label.

title

Optional Character: Chart title. Declared here because it is the one property every chart type has; palette is not (four take a colormap instead), and axis labels and margins are cartesian-only.

dat_path

Optional Character: Path to the data, read at draw time. The serializable alternative to passing data to draw().

origin

Optional Named character: Per-property provenance.

writer

Optional Named character: Interface name and version.

Value

A ConfusionConfig object.

Examples

setup_ConfusionConfig(panel = "split", classes = c("yes", "no"))
#> <ConfusionConfig>
#> 
#>              type: <chr> confusion
#>          dat_path: <NUL> NULL
#>             title: <NUL> NULL
#>            origin: <chr> default, default, default, default, ...
#>            writer: <NUL> NULL
#>         reference: <chr> reference
#>         predicted: <chr> predicted
#>             count: <chr> n
#>             panel: <chr> split
#>           classes: <chr> yes, no
#>      show_metrics: <lgc> TRUE
#>            digits: <int> 2
#>              ncol: <int> 2
#>     correct_color: <chr> #0F6A66
#>   incorrect_color: <chr> #BE2E5F
#>         low_color: <NUL> NULL
#>     summary_color: <NUL> NULL
#>         font_size: <nmr> 12.00
#>              xlab: <chr> Predicted
#>              ylab: <chr> Reference
#>