Skip to contents

Add a rohani heatmap to an exiting ggplot plot object. Possibly to be extended to include time series in a separate facet.

Usage

iidda_plot_rohani_heatmap(
  plot_object,
  data = NULL,
  series_variable = "deaths",
  start_year_variable = "Year",
  end_year_variable = "End Year",
  start_day_variable = "Day of Year",
  end_day_variable = "End Day of Year",
  grouping_variable = "cause",
  colour_trans = log1p_modified_trans(),
  n_colours = (scales::brewer_pal(palette = "YlOrRd"))(9),
  NA_colour = "black",
  palette_colour = "YlOrRd"
)

Arguments

plot_object

a `ggplot2` plot object

data

data frame containing data prepped for yearly vs. weekly heatmaps, typically output from `iidda_prep_heatmap()`. If `NULL` data is inherited from `plot_object`.

series_variable

column name of series variable in `data`, default is "deaths"

start_year_variable

column name of time variable containing the year of the starting period, defaults to "Year"

end_year_variable

column name of time variable containing the year of the ending period, defaults to "End Year"

start_day_variable

column name of time variable containing the day of the starting period, defaults to "Day of Year"

end_day_variable

column name of time variable containing the day of the ending period, defaults to "End Day of Year"

grouping_variable

column name of grouping variable to appear on the y-axis of the heatmap.

colour_trans

function to scale colours, to be supplied to trans argument of scale_fill_gradientn()

n_colours

vector of colours to be supplied to scale_fill_gradientn()

NA_colour

colour for `NA` values, defaults to "black"

palette_colour

colour of heatmap palette, defaults to "RdGy". Should specify what type of palette colours are accepted by this argument.

Value

a ggplot2 plot object containing a yearly vs. weekly heatmap of time series data