Specify output options for a static report containing heatmaps
Source:R/prepare.R
outputspec_static_heatmap.Rd
Each tab contains a heatmap with one row per time series.
Arguments
- fill_colour
colour to use for the tiles. Passed to
high
parameter ofggplot2::scale_fill_gradient()
- y_label
string for y-axis label. Optional. If
NULL
, the label will be constructed from theinputspec()
- item_order
named list corresponding to
item_cols
columns for ordering the items in the output. List values are eitherTRUE
for ascending order, or a character vector of values contained in the named column for explicit ordering. Ifitem_order = NULL
, the original order will be kept. See Details.
Details
For item_order
, the names of the list members should
correspond to the column names in the df
. Any names that don't match will
be ignored. When multiple columns are specified, they are sorted together,
in the same priority order as the list. If a list item is TRUE
then that
column is sorted in ascending order. If a list item is a character vector
then that column is sorted in the order of the vector first, with any
remaining values included alphabetically at the end. If you want to order
the tabs, it is recommended to put the tab_col
as the first item in the
list.
Examples
# Customise the plot
outspec <- outputspec_static_heatmap(
fill_colour = "#56B1F7",
y_label = "Daily records"
)
# Sort alphabetically by Antibiotic
outspec <- outputspec_static_heatmap(
item_order = list("Antibiotic" = TRUE)
)
# Sort alphabetically by Location first,
# then put "Vancomycin" and "Linezolid" before other antibiotics
outspec <- outputspec_static_heatmap(
item_order = list("Location" = TRUE,
"Antibiotic" = c("Vancomycin", "Linezolid"))
)