get_base_plot: Generates the plot

Description Usage Arguments Examples

View source: R/plotting_functions.R

Description

This function generates the base plot, upon receiving a list of plot data information

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
get_base_plot(
  dt,
  ytransform = "sqrt",
  empirical_label = paste0("Reported ", dt$outcome),
  model_label = paste0("Modelled ", dt$outcome),
  x_label = "Date",
  fill_label = "Range Estimates",
  color_label = "Outcomes",
  title_string = paste0(dt$location),
  dateticks = NULL,
  caption_below_plot = NULL,
  xlimits = NULL,
  yticklabels = ggplot2::waiver(),
  smooth = F,
  smooth_ci = F,
  legend_location = c("belowplot", "bottomright", "topleft"),
  labsize = 8
)

Arguments

dt

plot data, from the get_plot_data function

ytransform

defaults to "sqrt" but can be "identify", "log", "log10", etc

empirical_label

label for the plot legend for the empirical data (default is "Reported")

model_label

label for the plot legend for the modelled data (default is "Modelled")

x_label

label for the x-axis (default is "Date")

fill_label

label for the legend denoting the ribbon/range fills (default is "Range Estimates")

color_label

label for the legend deonoting the outcome color

title_string

default is to use the location from the dt list, but will be the title of plot

dateticks

a vector of dates for the x-axis

caption_below_plot

string value for the caption below (default is no caption)

yticklabels

a vector of ticks specified for the yaxis

smooth

add a generalized additive model cubic regression spline smoother to empirical data? (default is FALSE)

smooth_ci

add CI to the empirical data smoother? (default is F)

legend_location

specify the location of the legend, either 'belowplot' (default), 'topleft', or 'bottomright'

labsize

specify the text size for the axis tick labels and the legend (default is 8)

Examples

1
get_base_plot(plt_df, "sqrt", caption="My Caption")

lmullany/iddplotting documentation built on July 26, 2020, 8:05 p.m.