View source: R/vis-detection_bubble_plot.r
detection_bubble_plot | R Documentation |
Make bubble plots showing the number of fish detected across a defined set of receiver locations.
detection_bubble_plot(det, location_col = "glatos_array", receiver_locs = NULL, map = NULL, out_file = NULL, background_ylim = c(41.3, 49), background_xlim = c(-92.45, -75.87), symbol_radius = 1, col_grad = c("white", "red"), scale_loc = NULL)
det |
A OR a data frame containing detection
data with four columns described
below and one column containing a location grouping variable, whose name is
specified by The following four columns must appear in
|
location_col |
A character string indicating the column name in
|
receiver_locs |
An optional data frame containing receiver data with the
two columns ('deploy_lat', 'deploy_long') described below and one column
containing a location grouping variable, whose name is specified by
|
map |
An optional SpatialPolygonsDataFrame or other spatial object
that can by plotted with using |
out_file |
An optional character string with the name (including
extension) of output file created. File extension will determine type of
file written. For example, |
background_ylim |
A two-element numeric vector that defines minimum and maximum extents of the viewable plot area along the y-axis (i.e., longitude). |
background_xlim |
A two-element numeric vector that defines minimum and maximum extents of the viewable plot area along the x-axis (i.e., latitude). |
symbol_radius |
Radius of each "bubble" on the plot in units of percent of x-axis scale. Default value = 1 (i.e., 1 percent of x-axis). |
col_grad |
A two-element character vector indicating the start and end colors of the gradient scale used to color-code "bubbles". |
scale_loc |
An optional 4-element numeric vector, to be passed to
plotrix::color.legend, indicating the plotting location of the legend in
the same units as |
Data are summarized using summarize_detections.
If receiver_locs
is specified (not NULL) then the plot will
show all receivers in receiver_locs
including any that detected
none of the transmitters in det
. Although this is helpful to view
locations where fish were not detected, the user will usually want
to take care to include only receivers that were in the water during the
period of interest. If you are using a glatos receiver locations file to
specify location for plotting, you will likely want to filter the receiver
data by depoyment and receovery dates to exclude deployments that occured
outside of the period of interest.
"col_grad" is used in a call to colorRampPalette, which will accept a vector containing any two colors return by colors as character strings.
A data frame produced by
glatos::summarize_detections(det, location_col = location_col,
receiver_locs = receiver_locs, summ_type = "location")
If not out_file is specified, then an image is printed to the
default plot device. If out_file is specified, then an image of
specified type is written to out_file
.
T. R. Binder, edited by A. Dini
summarize_detections
#get path to example detection file det_file <- system.file("extdata", "walleye_detections.csv", package = "glatos") det <- read_glatos_detections(det_file) #call with defaults detection_bubble_plot(det) #change symbol size and color detection_bubble_plot(det, symbol_radius = 2, col_grad = c("grey90", "grey10")) #Add all receivers # get path to example receiver file rec_file <- system.file("extdata", "sample_receivers.csv", package = "glatos") rec <- read_glatos_receivers(rec_file) detection_bubble_plot(det, receiver_locs = rec) #' #Subset receivers to include on receivers that were deployed during the #' detection interval. # get path to example receiver file rec_file <- system.file("extdata", "sample_receivers.csv", package = "glatos") rec <- read_glatos_receivers(rec_file) first <- min(det$detection_timestamp_utc) # time of first detection last <- max(det$detection_timestamp_utc) # time of last detection # Subset receiver deployments oustide the detection period. # !is.na(rec$recover_date_time) eliminates receivers that have been # deployed but not yet recovered. plot_rec <- rec[rec$deploy_date_time < last & rec$recover_date_time > first & !is.na(rec$recover_date_time),] detection_bubble_plot(det, receiver_locs = plot_rec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.