Skip to contents

Plot quantiles given hubverse formatted data for all locations in the dataset or a subset of them.

Usage

plot_hubverse_quantiles(
  forecast_data_path,
  locations = NULL,
  truth_data_path = NULL,
  start_date = NULL,
  end_date = NULL,
  location_input_format = "abbr",
  location_output_format = "abbr",
  ytrans = "log10",
  linesize = 2,
  pointsize = 4,
  forecast_linecolor = "darkblue",
  forecast_pointcolor = "darkblue",
  truth_linecolor = "black",
  truth_pointcolor = "black",
  autotitle = TRUE
)

Arguments

forecast_data_path

path to hubverse- formatted forecast data, as a single .csv.

locations

set of locations to plot. If NULL, all locations are plotted. Otherwise, a vector of location values to plot, as USPS-style abbreviations (e.g. c("US", "AL", "AK"), US hubverse submission location codes ( e.g. c("US", 01, 02)), or full English jurisdiction names (e.g. c("United States, "Alabama", "Alaska"). Default NULL.

truth_data_path

path to hubverse formatted truth data to plot alongside the forecast quantiles. If NULL, only the forecast quantiles will be plotted. Default NULL.

start_date

first date to plot. If NULL, defaults to the earliest date found between the forecast timeseries ( obtained from forecast_data_path) and the truth data timeseries (obtained from truth_data_path, if provided). Default NULL.

end_date

final date to plot. If NULL, defaults to the latest date found between the forecast timeseries ( obtained from forecast_data_path) and the truth data timeseries (obtained from truth_data_path, if provided). Default NULL.

location_input_format

format of the provided location vector. Permitted formats are "abbr" (state/territory or nation two letter USPS abbreviation), "hub" ( legacy 2-digit FIPS code for states and territories, US for the USA as a whole), and "long_name" (full English jurisdiction names; not recommended). Default "abbr".

location_output_format

Location format for naming the entries of the output list. Accepts the same string keys as location_input_format.

ytrans

axis transform passed to ggplot2::scale_y_continuous(). Default 'log10'.

linesize

size parameter passed to ggplot2::geom_line(). Default 2.

pointsize

size parameter passed to ggplot2::geom_point(). Default 4.

forecast_linecolor

color parameter passed to ggplot2::geom_line() for plotting forecasts. Default "darkblue".

forecast_pointcolor

color parameter passed to ggplot2::geom_point() for plotting forecasts. Default "darkblue".

truth_linecolor

color parameter passed to ggplot2::geom_line() for plotting truth data. Default "black".

truth_pointcolor

color parameter passed to ggplot2::geom_point() for plotting truth data. Default "black".

autotitle

Boolean. Generate a title for the individual plots from the hubverse reference_date and the location name? Default TRUE.

Value

a list of ggplot objects of the plots created, one for each location