Learn R Programming

cvms (version 1.7.0)

sum_tile_settings: Create a list of settings for the sum tiles in plot_confusion_matrix()

Description

lifecycle::badge("experimental")

Creates a list of settings for plotting the column/row sums in plot_confusion_matrix().

The `tc_` in the arguments refers to the total count tile.

NOTE: This is very experimental and will likely change.

Usage

sum_tile_settings(
  palette = NULL,
  label = NULL,
  tile_fill = NULL,
  font_color = NULL,
  tile_border_color = NULL,
  tile_border_size = NULL,
  tile_border_linetype = NULL,
  tc_tile_fill = NULL,
  tc_font_color = NULL,
  tc_tile_border_color = NULL,
  tc_tile_border_size = NULL,
  tc_tile_border_linetype = NULL,
  intensity_by = NULL,
  intensity_lims = NULL,
  intensity_beyond_lims = NULL
)

Value

List of settings.

Arguments

palette

Color scheme to use for sum tiles. Should be different from the `palette` used for the regular tiles.

Passed directly to `palette` in ggplot2::scale_fill_distiller.

Try these palettes: "Greens", "Oranges", "Greys", "Purples", "Reds", and "Blues".

Alternatively, pass a named list with limits of a custom gradient as e.g. `list("low"="#e9e1fc", "high"="#BE94E6")`. These are passed to ggplot2::scale_fill_gradient.

Note: When `tile_fill` is specified, the `palette` is ignored.

label

The label to use for the sum column and the sum row.

tc_tile_fill, tile_fill

Specific background color for the tiles. Passed as `fill` to ggplot2::geom_tile.

If specified, the `palette` is ignored.

tc_font_color, font_color

Color of the text in the tiles with the column and row sums.

tc_tile_border_color, tile_border_color

Color of the tile borders. Passed as `colour` to ggplot2::geom_tile.

tc_tile_border_size, tile_border_size

Size of the tile borders. Passed as `size` to ggplot2::geom_tile.

tc_tile_border_linetype, tile_border_linetype

Linetype for the tile borders. Passed as `linetype` to ggplot2::geom_tile.

intensity_by

The measure that should control the color intensity of the tiles. Either `counts`, `normalized`, `row_percentages`, `col_percentages`, or one of `log counts`, `log2 counts`, `log10 counts`, `arcsinh counts`.

For `normalized`, `row_percentages`, and `col_percentages`, the color limits become 0-100 (except when `intensity_lims` are specified), why the intensities can better be compared across plots.

Note: When `add_sums=TRUE`, the `row_percentages` and `col_percentages` options are only available for the main tiles. A separate intensity metric must be specified for the sum tiles (e.g., via `sums_settings = sum_tile_settings(intensity_by='normalized')`).

For the `log*` and `arcsinh` versions, the log/arcsinh transformed counts are used.

Note: In `log*` transformed counts, 0-counts are set to `0`, why they won't be distinguishable from 1-counts.

intensity_lims

A specific range of values for the color intensity of the tiles. Given as a numeric vector with c(min, max).

This allows having the same intensity scale across plots for better comparison of prediction sets.

intensity_beyond_lims

What to do with values beyond the `intensity_lims`. One of "truncate", "grey".

Author

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

See Also

Other plotting functions: font(), plot_confusion_matrix(), plot_metric_density(), plot_probabilities(), plot_probabilities_ecdf()