Plots time series of boxplots showing detection data across time
plotDetectionBoxplot(
x,
group = "species",
facet = NULL,
color = hue_pal(),
bin = "day/week",
combineYears = FALSE,
effort = NULL,
dropZeroes = FALSE,
returnData = FALSE
)
a ggplot object
dataframe of detection data read in with loadDetectionData
name(s) of columns indicating which rows of x
are
distinct from each other, typically something like "site" or "species"
or both. These are used to define the different data points that go
in to each boxplot, see Details below for more information.
if not NULL
, name of the column in x
to facet
the plot by
only used if facet
is not NULL
, colors to use
for each separate facet. Can either be a color palette function or a
character vector of color names. If a vector, it can be named by the
levels in facet
that each color should correspond to
time bins to use for generating plot, must be a character of
format "time1/time2" where "time1" will be the y-axis of the plot and
"time2" will be the x-axis of the plot. Times are one of "hour", "day",
"week", or "month" (e.g. "day/week"
).
logical flag to combine all observations to display as a single "year"
if not NULL
, a dataframe describing on effort times
to be formatted with formatEffort. If effort data is not provided
then times with zero detections will not be properly accounted for.
logical flag to remove boxplots where all observations are zero (these would normally appear as a flat line at zero)
if TRUE
then no plot will be generated, instead the
dataframe that would normally be used to make the plot will be returned
Taiki Sakai taiki.sakai@noaa.gov
The combination of group
, facet
, and
combineYears
determine the data points that make up each boxplot.
If combineYears=TRUE
, then there will be a different point for
each year. There will additionally be separate points for each different
value of the columns in group
, excluding the column used for
facet
(since these points are instead split out to different
facetted plots).
For example, if you have data from a single location, then settings of
combineYears=FALSE
, group='species'
, and facet=NULL
will create a plot where each point in a boxplot represents the number
of detections for a species. If you change to facet='species'
,
then the result will show a multi panel plot where each boxplot is just
a single point. Then changing to combineYears=TRUE
will show
a multi panel plot where each point in a boxplot is the number of
detections for that panel's species in different years.