Learn R Programming

cvms (version 1.8.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_counts_color = NULL,
  font_normalized_color = NULL,
  dynamic_font_colors = dynamic_font_color_settings(),
  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,
  font_color = deprecated()
)

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.

font_counts_color, font_normalized_color

Color of the text in the tiles with the column and row sums. Either the value directly passed to ggplot2::geom_text or a function that take in the values (e.g., counts, percentages, etc.) and returns a vector of values to pass to ggplot2::geom_text.

dynamic_font_colors

A list of settings for using dynamic font colors based on the value of the counts/normalized. Allows changing the font colors when the background tiles are too dark, etc. Can be provided with dynamic_font_color_settings(threshold =, by =, all =, counts =, normalized =).

Individual thresholds can be set for the different fonts/values via the `font_*_color` arguments. Specifying colors in these arguments will overwrite this argument (for the specific font only).

Specifying colors for specific fonts overrides the "all" values for those fonts.

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

Color of the text in the total count tile.

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".

font_color

Deprecated.

Author

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

See Also

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