This function plots ESP indicator traffic light figures

esp_traffic(
  data,
  name,
  out = "ggplot",
  paginate = FALSE,
  label = TRUE,
  status = TRUE,
  caption = "",
  ncolumn = 1,
  silent = FALSE,
  min_year = NULL,
  chunk_label = "traffic",
  f_units = FALSE,
  y_units = TRUE,
  ...
)

Arguments

data

The ESP indicator data. Should have a column for Year and a column for each indicator.

name

The file name for the image. Will be saved relative to the working directory.

out

Whether the function should save the plot, print a ggplot object in markdown, or return a ggplot object to the working environment (for use with one_pager()). One of c("ggplot", "save", "one_pager")

paginate

Whether to paginate the plots with ggforce::facet_wrap_paginate

label

Whether to label the facets with a, b, c, etc.

status

Whether to label the facets with the indicator status

caption

A caption for the figure

ncolumn

How many columns the figure should have (1 by default)

silent

Whether to print the caption

min_year

The minimum year to show on the plots. If left NULL (the default), the minimum year will be the first year of the dataset.

chunk_label

The label name to look for to create the figure number. This is a work-around to deal with figure pagination.

f_units

Whether to add units in the facet header

y_units

Whether to add units to the y-axis

...

Passed to ggplot2::ggsave

Value

An image file