Description Usage Arguments Value Examples
plot_exposure
returns a plot of pesticide application in the PLS units
intersected by a buffer for each combination of time period, applied active
ingredients, and application method relevant for the exposure values returned
from calculate_exposure
.
1 2 3 4 5 6 7 8 9 10 | plot_exposure(
exposure_list,
color_by = "amount",
buffer_or_county = "county",
percentile = c(0.25, 0.5, 0.75),
fill = "viridis",
alpha = 0.7,
pls_labels = FALSE,
pls_labels_size = 4
)
|
exposure_list |
A list returned from |
color_by |
Either "amount" (the default) or "percentile". Specifies
whether you would like application amounts to be colored according to
amount, resulting in a gradient legend, or by the percentile that they fall
into for the given data set and date range. You can specify percentile
cutpoints with the |
buffer_or_county |
Either "county" (the default) or "buffer". Specifies whether you would like colors to be scaled according to the limits of application within the buffer, or in the county for the same time period, chemicals, and method of application. |
percentile |
A numeric vector in (0, 1) specifying percentile cutpoints
if |
fill |
A palette from the colormap package. The default is
"viridis". To see colormap palette options, visit
https://bhaskarvk.github.io/colormap/ or run
|
alpha |
A number in [0,1] specifying the transparency of fill colors. Numbers closer to 0 will result in more transparency. The default is 0.7. |
pls_labels |
TRUE / FALSE for whether you would like sections or townships
to be labeled with their PLS ID. The default is |
pls_labels_size |
A number specifying the size of PLS labels. The default is 4. |
A list with the following elements:
A list of plots. One plot for each exposure value returned in
the exposure
element of the calculate_exposure
list.
A list of data frames with 12 columns: pls
, giving
the PLS ID, percent
, the
buffer, kg
, the amount of kg of pesticides applied in that PLS unit
for the relevant time period, chemicals, and application method,
kg_intersection
, kg
multiplied by percent
(this is the
value that is plotted), start_date
, end_date
, chemicals
,
aerial_ground
, which give the time period, chemicals, and application
method for each plot/exposure estimate, none_recorded
, location
,
radius
(m), and area
(m^2).
A list of data frames with two columns: percentile
and
kg
giving the cutoff values for each percentile. Only returned if
color_by = "percentile"
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | library(magrittr)
fresno_list <- readRDS(system.file("extdata", "exposure_ex.rds",
package = "purexposure")) %>% plot_exposure()
tulare_list <- pull_clean_pur(2010, "tulare")
calculate_exposure(location = "-119.3473, 36.2077", radius = 3500)
plot_exposure()
names(tulare_list)
tulare_list$maps
tulare_list$pls_data
tulare_list$exposure
# return one plot, pls_data data frame, exposure row, and cutoff_values
# data frame for each exposure combination
dalton_list <- pull_clean_pur(2000, "modoc")
calculate_exposure(location = "-121.4182, 41.9370",
radius = 4000,
time_period = "6 months",
aerial_ground = TRUE)
plot_exposure(fill = "plasma")
do.call("rbind", dalton_list$exposure)
# one map for each exposure value (unique combination of chemicals,
# dates, and aerial/ground application)
dalton_list$maps[[1]]
dalton_list$maps[[2]]
dalton_list$maps[[3]]
dalton_list$maps[[4]]
dalton_list$maps[[5]]
dalton_list$maps[[6]]
# exposure to a particular active ingredient
# plot percentile categories instead of amounts
chemical_df <- rbind(find_chemical_codes(2009, c("metam-sodium")))
dplyr::rename(chemical_class = chemical)
santa_maria <- pull_clean_pur(2008:2010, "santa barbara",
chemicals = chemical_df$chemname,
sum_application = TRUE,
sum = "chemical_class",
chemical_class = chemical_df)
calculate_exposure(location = "-119.6122, 34.90635",
radius = 3000,
time_period = "1 year",
chemicals = "chemical_class")
plot_exposure(color_by = "percentile")
do.call("rbind", santa_maria$exposure)
santa_maria$maps[[1]]
santa_maria$maps[[2]]
santa_maria$maps[[3]]
# scale colors based on buffer or county
clotho <- pull_clean_pur(1996, "fresno")
dplyr::filter(chemname == "SULFUR")
calculate_exposure(location = "-119.6082, 36.7212",
radius = 1500)
plot_exposure(clotho, "amount", buffer_or_county = "county", pls_labels = TRUE)$maps
plot_exposure(clotho, "amount", buffer_or_county = "buffer", pls_labels = TRUE)$maps
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.