mplot3_conf: Plot confusion matrix

View source: R/mplot3_conf.R

mplot3_confR Documentation

Plot confusion matrix

Description

Plots confusion matrix and classification metrics

Usage

mplot3_conf(
  object,
  main = "auto",
  xlab = "Reference",
  ylab = "Estimated",
  plot.metrics = TRUE,
  mod.name = NULL,
  oma = c(0, 0, 0, 0),
  dim.main = NULL,
  dim.lab = 1,
  dim.in = 4,
  dim.out = -1,
  font.in = 2,
  font.out = 1,
  cex.main = 1.2,
  cex.in = 1.2,
  cex.lab = 1.2,
  cex.lab2 = 1.2,
  cex.lab3 = 1,
  cex.out = 1,
  col.main = "auto",
  col.lab = "auto",
  col.text.out = "auto",
  col.bg = "auto",
  col.bg.out1 = "auto",
  col.bg.out2 = "auto",
  col.text.hi = "auto",
  col.text.lo = "auto",
  show.ba = TRUE,
  theme = getOption("rt.theme", "white"),
  mid.col = "auto",
  hi.color.pos = "#18A3AC",
  hi.color.neg = "#C23A70",
  autolabel = letters,
  par.reset = TRUE,
  pdf.width = 7,
  pdf.height = 7,
  filename = NULL,
  ...
)

Arguments

object

Either a classification rtMod, or a table/matrix/data.frame.

main

Character: Plot title.

xlab

Character: x-axis label.

ylab

Character: y-axis label.

plot.metrics

Logical: If TRUE, draw classification metrics next to confusion matrix.

mod.name

Character: Name of the algorithm used to make predictions. If NULL, will look for object$mod.name.

oma

Numeric, vector, length 4: Outer margins.

dim.main

Numeric: Height for title.

dim.lab

Numeric: Height for labels.

dim.in

Numeric: Height/Width for confusion matrix cells.

dim.out

Numeric: Height for metrics cells. Default = -1, which autoadjusts depending on number of output classes.

font.in

Integer: The font parameter for confusion matrix cells.

font.out

Integer: The font parameter for metrics cells.

cex.main

Numeric: The cex parameter for the main title.

cex.in

Numeric: The cex parameter for confusion matrix cells.

cex.lab

Numeric: The cex parameter for first line of label cells.

cex.lab2

Numeric: The cex parameter for second line of label cells.

cex.lab3

Numeric: The cex parameter for classification metrics.

cex.out

Numeric: The cex parameter for metrics cells.

col.main

Color for title. Default = "auto", determined by theme.

col.lab

Color for labels. Default = "auto", determined by theme.

col.text.out

Color for metrics cells' text. Default = "auto", determined by theme.

col.bg

Color for background. Default = "auto", determined by theme.

col.bg.out1

Color for metrics cells' background (row1). Default = "auto", determined by theme.

col.bg.out2

Color for metrics cells' background (row2). Default = "auto", determined by theme.

col.text.hi

Color for high confusion matrix values. Default = "auto", determined by theme.

col.text.lo

Color for low confusion matrix values. Default = "auto", determined by theme.

show.ba

Logical: If TRUE, show Balanced Accuracy at bottom right corner.

theme

Character: "light", or "dark". Set to options("rt.theme"), if set, otherwise "light"

mid.col

Color: The mid color for the confusion matrix. Default = "auto", determined by theme.

hi.color.pos

Color: The hi color for correct classification.

hi.color.neg

Color: The hi color for missclassification.

autolabel

Character vector to be used to generate autolabels when using rtlayout with autolabel = TRUE.

par.reset

Logical: If TRUE, reset par before exit.

pdf.width

Numeric: PDF width, if filename is set.

pdf.height

Numeric: PDF height, if filename is set.

filename

Character: If specified, save plot to this path.

...

Additional arguments passed to theme.

Details

This function uses its multiple cex args instead of the theme's cex parameter

Value

List of metrics, invisibly

Author(s)

E.D. Gennatas

Examples

## Not run: 
true <- c("alpha", "alpha", "alpha", "alpha", "beta", "beta", "beta", "beta")
predicted <- c("alpha", "alpha", "alpha", "beta", "beta", "alpha", "alpha", "beta")
mplot3_conf(table(predicted, true))

## End(Not run)

egenn/rtemis documentation built on April 24, 2024, 6:58 p.m.