Creates a graph of warm or cold events as per the second row of Figure 3 in Hobday et al. (2016).
event_line( data, x = t, y = temp, min_duration = 5, spread = 150, metric = "intensity_cumulative", start_date = NULL, end_date = NULL, category = FALSE, x_axis_title = NULL, x_axis_text_angle = NULL, y_axis_title = NULL, y_axis_range = NULL )
The function receives the full (list) output from the
This column is expected to contain a vector of dates as per the
This is a column containing the measurement variable. If the column
name differs from the default (i.e.
The minimum duration (days) the event must be for it to qualify as a heatwave or cold-spell.
The number of days leading and trailing the largest event
This tells the function how to choose the event that should be
highlighted as the 'greatest' of the events in the chosen period. One may
choose from the following options:
The start date of a period of time within which the largest
event (as per
The end date of a period of time within which the largest
event (as per
A boolean choice of TRUE or FALSE. If set to FALSE (default) event_line() will
produce a figure as per the second row of Figure 3 in Hobday et al. (2016). If set to TRUE a
figure showing the different categories of the MHWs in the chosen period, highlighted as
seen in Figure 3 of Hobday et al. (in review), will be produced. If
If one would like to add a title for the x-axis it may be provided here.
If one would like to change the angle of the x-axis text, provide the angle here as a single numeric value.
Provide text here if one would like a title for the y-axis other than "Temperature °C" (default)
If one would like to control the y-axis range, provide the desired limits here as two numeric values (e.g. c(20, 30)).
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
The top event detect during the selected time period will be visible in a
brighter colour. This function differs in use from
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.
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
ts <- ts2clm(sst_WA, climatologyPeriod = c("1983-01-01", "2012-12-31")) res <- detect_event(ts) event_line(res, spread = 100, metric = "intensity_cumulative", start_date = "2010-12-01", end_date = "2011-06-30")event_line(res, spread = 100, start_date = "2010-12-01", end_date = "2011-06-30", category = TRUE)