--- a +++ b/man/plot_cm.Rd @@ -0,0 +1,40 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/help_functions.R +\name{plot_cm} +\alias{plot_cm} +\title{Plot confusion matrix} +\usage{ +plot_cm( + cm, + perc = FALSE, + cm_labels, + round_dig = 2, + text_size = 1, + highlight_diag = TRUE +) +} +\arguments{ +\item{cm}{A confusion matrix} + +\item{perc}{Whether to use absolute numbers or percentages.} + +\item{cm_labels}{Labels corresponding to confusion matrix entries.} + +\item{round_dig}{How to round numbers.} + +\item{text_size}{Size of text annotations.} + +\item{highlight_diag}{Whether to highlight entries in diagonal.} +} +\value{ +A ggplot of a confusion matrix. +} +\description{ +Plot confusion matrix, either with absolute numbers or percentages per column (true labels). +} +\examples{ +\dontshow{if (reticulate::py_module_available("tensorflow")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +cm <- matrix(c(90, 1, 0, 2, 7, 1, 8, 3, 1), nrow = 3, byrow = TRUE) +plot_cm(cm, perc = TRUE, cm_labels = paste0('label_', 1:3), text_size = 8) +\dontshow{\}) # examplesIf} +}