plot_fac_trend: Plot a single facility metric

View source: R/plot_fac_trend.R

plot_fac_trendR Documentation

Plot a single facility metric

Description

Creates time series plots showing the trend for a single facility for a given metric, formatted according to the style guide. Returns a ggplot object, so additional layers can be added, per the examples.

Usage

plot_fac_trend(
  fac_name,
  state,
  metric,
  scrape_df = NULL,
  plot_days = NULL,
  area_plot = F,
  annotate = F,
  auto_label = F
)

Arguments

fac_name

character string of the facility to plot

state

character string of the facility's state

metric

character string of the metric to plot

scrape_df

data frame with scraped data

plot_days

integer, number of days to plot

area_plot

logical, whether to create an area plot (vs. a line plot)

annotate

logical, whether to include text annotations for most recent value

auto_label

logical, whether to label plot title, subtitle, axes based on behindbarstools::get_metric_description

Value

ggplot object

Examples

## Not run: 
plot_fac_trend("Los Angeles Jails", "California", "Residents.Active")

## End(Not run)

## Not run: 
plot_fac_trend("Los Angeles Jails", "California", "Residents.Active") +
    scale_x_date(date_labels = "%m/%y") +
    labs(x = "Cases") +
    ylim(0, 150)

## End(Not run)


uclalawcovid19behindbars/behindbarstools documentation built on April 22, 2022, 4:08 a.m.