plot_county_locations: Plot a county's location in California.

Description Usage Arguments Value Examples

View source: R/05-plot.R

Description

plot_county_locations returns one or multiple plots with county locations in California given either a vector of county names or codes, or a PUR data frame with a county_cd, county_name, pur_code, or fips_code column (A data frame returned from either pull_pur_file, pull_raw_pur, or pull_clean_pur).

Usage

1
2
3
4
5
6
7
plot_county_locations(
  counties_or_df,
  separate_plots = FALSE,
  fill_color = "red",
  alpha = 0.5,
  ...
)

Arguments

counties_or_df

A character vector of county names, pur codes, or fips codes. You can use the county_codes data set included with this package to check out PUR county names and codes. This argument can also be a data frame with a county_cd, county_name, pur_code, or fips_code column. If you provide a data frame, a plot for every county with data in that data set will be output.

separate_plots

TRUE / FALSE. If you provided multiple counties, whether you would like county outlines plotted in the same plot (FALSE), or if you would like separate plots returned in a list (TRUE). The default is FALSE.

fill_color

A character string giving either a ggplot2 color or a hex color code ("#0000FF", for example). The default is "red".

alpha

A number in [0,1] specifying the transparency of the fill color. Numbers closer to 0 will result in more transparency. The default is 0.5.

...

Used internally.

Value

A ggplot or a list of ggplots of Califnornia with shaded-in counties. List element names correspond to county names.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
fresno_spdf <- readRDS(system.file("extdata", "fresno_spdf.rds",
                                   package = "purexposure"))
plot_county_locations("fresno", spdf = fresno_spdf)

plot_county_locations("fresno")

pur_df <- pull_clean_pur(1990, counties = c("01", "05", "12"))
plot_county_locations(pur_df)

plot_list <- plot_county_locations(c("san bernardino", "ventura"),
                                   separate_plots = TRUE)
names(plot_list)
plot_list[[1]]
plot_list[[2]]

leighseverson/purexposure documentation built on Aug. 13, 2021, 6:34 p.m.