event_line {RmarineHeatWaves} | R Documentation |
Create a Line Plot of Marine Heat Waves or Cold Spells.
Description
Creates a graph of warm or cold events as per the second row of Figure 3 in Hobday et al. (2016).
Usage
event_line(data, x = t, y = temp, min_duration = 5, spread = 150,
metric = "int_cum", start_date, end_date)
Arguments
data |
The function receives the output from the |
x |
This column is expected to contain a vector of dates as per the
specification of |
y |
This is a column containing the measurement variable. If the column
name differs from the default (i.e. |
min_duration |
The minimum duration that an event has to for it to qualify as a marine heat wave or marine cold spell. |
spread |
The the number of days leading and trailing the largest event
(as per |
metric |
One of the following options: |
start_date |
The start date of a period of time within which the largest
event (as per |
end_date |
The end date of a period of time within which the largest
event (as per |
Value
The function will return a line plot indicating the climatology,
threshold and temperature, with the hot or cold events that meet the
specifications of Hobday et al. (2016) shaded in as appropriate. The plotting
of hot or cold events depends on which option is specified in detect
.
The top event detect during the selected time period will be visible in a
brighter colour. This function differs in use from geom_flame
in that it creates a stand alone figure. The benefit of this being
that one must not have any prior knowledge of ggplot2 to create the figure.
Author(s)
Robert W. Schlegel
References
Hobday, A.J. et al. (2016), A hierarchical approach to defining marine heatwaves, Progress in Oceanography, 141, pp. 227-238, doi: 10.1016/j.pocean.2015.12.014
Examples
ts_dat <- make_whole(sst_WA)
res <- detect(ts_dat, climatology_start = "1983-01-01",
climatology_end = "2012-12-31")
## Not run:
event_line(res, spread = 200, metric = "int_cum",
start_date = "2010-10-01", end_date = "2011-08-30")
## End(Not run)