Skip to contents

Parameters to customize heatmaps in robotables and robomaps.

Usage

set_heatmap(
  maxcolor = last(getOption("roboplot.colors.traces")),
  midcolor = getOption("roboplot.colors.background"),
  mincolor = first(getOption("roboplot.colors.traces")),
  maxvalue = NULL,
  midvalue = NULL,
  minvalue = NULL,
  na_color = getOption("roboplot.colors.background")
)

Arguments

maxcolor, midcolor, mincolor, na_color

Characters. Colors used for heatmap color range. Must be a hexadecimal colors or a valid css colors.

maxvalue, midvalue, minvalue

Numerics. Optional. Numeric breakpoints where maxcolor, midcolor and mincolor are set at. Any values falling outside of this range will have the nearest corresponding color. If not provided, robotable() calculates the values from the data. Currently only support heatmaps across all numeric columns in the given robotable().

Value

A list of class roboplot.set_heatmap

Examples

# Use `set_heatmap()` to specify any the colors are value breaks used in heatmaps.

d <- roboplotr::energiantuonti |>
  dplyr::filter(Alue %in% c("Ruotsi","USA")) |>
  tidyr::unite(Tiedot, Alue, Suunta, sep = ", ") |>
  dplyr::arrange(Tiedot, time) |>
  tidyr::pivot_wider(names_from = Tiedot) |>
  dplyr::mutate(dplyr::across(where(is.numeric), ~ tidyr::replace_na(.x, 0))) |>
  dplyr::arrange(time)
# No specifications uses the ends of the default trace colors set with
# `set_roboplot_options()` and bases the numeric breakpoints on the data.

d |> robotable(heatmap = set_heatmap())
# You can specify any of the parameters separately, and `robotable()` fills in the rest. d |> robotable(heatmap = set_heatmap( midcolor = "white", mincolor = "lightblue", midvalue = 75 ))