View source: R/vis-abacus_plot.r
abacus_plot | R Documentation |
Plot detection locations of acoustic transmitters over time.
abacus_plot(det, location_col = "glatos_array", locations = NULL, show_receiver_status = NULL, receiver_history = NULL, out_file = NULL, x_res = 5, x_format = "%Y-%m-%d", outFile = NULL, ...)
det |
A OR A data frame containing detection data with at least two columns,
one of which must be named 'detection_timestamp_utc', described below, and
another column containing a location grouping variable, whose name is
specified by The following column must appear in
|
location_col |
A character string indicating the column name in
|
locations |
An optional vector containing the locations
|
show_receiver_status |
DEPCRECATED. No longer used. A logical value
indicating whether or not to display receiver status behind detection data
(i.e., indicate when receivers were in the water). If
|
receiver_history |
An optional OR An optional data frame containing receiver history data for plotting receiver status behind the detection data. The following column must be present:
|
out_file |
An optional character string with the name (including
extension) of output image file to be created. File extension will determine
type of file written. For example, |
x_res |
Resolution of x-axis major tick marks. If numeric (e.g., 5
(default value), then range of x-axis will be divided into that number of
equally-spaced bins; and will be passed to |
x_format |
Format of the x-axis tick mark labels (major ticks only; minor ticks are not supported). Default is " strptime specification should work. |
outFile |
Deprecated. Use |
... |
Other plotting arguments that pass to plot, points
(e.g., |
NAs are not allowed in any of the two required columns.
The locations vector is used to control which locations will appear
in the plot and in what order they will appear. If no locations vector is
supplied, the function will plot only those locations that appear in the
det
data frame and the order of locations on the y-axis will be
alphebetical from top to bottom.
By default, the function does not distinguish detections from different transmitters and will therefore plot all transmitters the same color. If more than one fish is desired in a single plot, a vector of colors must be passed to the function using the 'col =' argument. The color vector must be the same length as the number of rows in the detections data frame or the colors will be recycled.
Plotting options (i.e., line width and color) can be changed using optional graphical parameters http://www.statmethods.net/advgraphs/parameters.html that are passed to "points" (see ?points).
An image to the default plot device or a file containing the image if
out_file
is specified.
T. R. Binder, edited by A. Dini
#get path to example detection file det_file <- system.file("extdata", "walleye_detections.csv", package = "glatos") det <- read_glatos_detections(det_file) #subset one transmitter det2 <- det[det$animal_id == 153, ] #plot without control table and main tile and change color to red abacus_plot(det2, locations=NULL, main = "TagID: 32054", col = "red") #example with locations specified abacus_plot(det2, locations=c("DRF", "DRL", "FMP", "MAU", "PRS", "RAR", "DRM", "FDT"), main = "TagID: 32054", col = "red") #plot with custom y-axis label and lines connecting symbols abacus_plot(det2, main = "TagID: 32054", type = "o", pch = 20, col = "red") #plot with custom x-axis resolution - 10 bins abacus_plot(det2, main = "TagID: 32054", x_res = 10) #plot with custom x-axis resolution - monthly bins abacus_plot(det2, main = "TagID: 32054", x_res = "month") #plot with custom x-axis resolution - 8-week bins abacus_plot(det2, main = "TagID: 32054", x_res = "8 weeks") #plot with custom x-axis format abacus_plot(det2, main = "TagID: 32054", x_res = "months", x_format = "%b-%y") #plot with custom x axis limits xLim <- as.POSIXct(c("2012-01-01", "2014-01-01"), tz = "UTC") abacus_plot(det2, main = "TagID: 32054", xlim = xLim) #example with receiver locations # get example receiver location data rec_file <- system.file("extdata", "sample_receivers.csv", package = "glatos") rec <- read_glatos_receivers(rec_file) abacus_plot(det2, locations=c("DRF", "DRL", "FMP", "MAU", "PRS", "RAR", "DRM", "FDT"), receiver_history = rec, main = "TagID: 32054", col = "red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.