stfl_plot_trends: Plot the results from station level fits to various...

Description Usage Arguments Value Examples

View source: R/stfl_plot_trends.R

Description

Plot the results from station level fits to various statistics and various stations

Usage

1
2
3
4
5
6
7
stfl_plot_trends(
  fit.res,
  plot.fit = c("LMrob", "LM", "MK")[1],
  connect.points = TRUE,
  force.Y.scale.log = FALSE,
  plotly = TRUE
)

Arguments

fit.res

Fit result created by tfl_trend_kstn_kstat() which is a list and each element of the list has the estimates data.frame and the data.aug data.frame with original data with the predicted values from a LM, MK, and LMrob fit.

plot.fit

Which trend lines should be added to the plots. Possible values are one or more of

  • LM: Ordinary regression using the lm() function

  • MK: Mann-Kendall estimates using Sen estimator

  • LMrob: Robust linear regression fit using the lmrob() function from the robustbase package

If you try and plot a method that was not computed, a warning message is printed and the request is ignored.

connect.points

Should the annualized values be connected with a line.

force.Y.scale.log

Should the Y axis be plotted on the log-scale regardless if the fits are done on the log scale. Note that if the original fit was NOT done on the log(Y) scale, then setting force.Y.scale.log=TRUE will NOT change the fit - only the ysalce

plotly

Should a plot_ly() graph be returned (default), or a ggplot graph

Value

plot_ly graph of the results

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
# needs the HYDAT package installed
station.id <- "08NM116"
data <- stfl_get_annual_stat(station.id, Statistic=c("MEAN","P10","P90"))
temp <- stfl_trend_kstn_kstat(data, log.Y=TRUE)
stfl_plot_trends(temp, plot.fit=c("MK","LM","LMrob"))
stfl_plot_trends(temp, plot.fit=c("LMrob"), plotly=TRUE)

## End(Not run)

bcgov/StreamFlowTrend documentation built on Dec. 19, 2021, 7:38 a.m.