Description Usage Arguments Value Author(s) References Examples
View source: R/graph_functions.R
Creates a graph of warm or cold events as per the second row of Figure 3 in Hobday et al. (2016).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
data |
The function receives the full (list) 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 (days) the event must be for it to qualify as a heatwave or cold-spell. |
spread |
The number of days leading and trailing the largest event
(as per |
metric |
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: |
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 |
category |
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 |
x_axis_title |
If one would like to add a title for the x-axis it may be provided here. |
x_axis_text_angle |
If one would like to change the angle of the x-axis text, provide the angle here as a single numeric value. |
y_axis_title |
Provide text here if one would like a title for the y-axis other than "Temperature °C" (default) |
y_axis_range |
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 detect_event
.
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.
Robert W. Schlegel
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
1 2 3 4 5 6 7 8 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.