View source: R/plot_fac_trend.R
plot_fac_trend | R Documentation |
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.
plot_fac_trend( fac_name, state, metric, scrape_df = NULL, plot_days = NULL, area_plot = F, annotate = F, auto_label = F )
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 |
ggplot object
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.