RAnEnExtra::plotAnalogTimeSeries plots forecasts and observations for comparison over time.
plotAnalogTimeSeries( start.time, end.time, i.station, obs.id = NULL, obs.times = NULL, obs.data = NULL, anen.times, anen.flts, anen.data, fcst.id = NULL, fcst.times = NULL, fcst.flts = NULL, fcst.data = NULL, max.flt = 82800, origin = "1970-01-01", tz = "UTC", y.lab = "", return.data = F, legend.names = c(anen = "AnEn median", obs = "Observations", fcst = "Forecasts"), color.func.line = ggplot2::scale_color_brewer("", palette = "Dark2"), color.func.shade = ggplot2::scale_fill_manual("", values = c(`AnEn range` = "lightgrey", `AnEn 25% ~ 75%` = "lightblue")) )
start.time | A POSIXct for the start time. |
---|---|
end.time | A POSIXct for the end time. |
i.station | The station index to visualize. This can
be a single scalar so that the same station index for
observations, AnEn, and forecasts is used; or it can be
a named vector like this:
|
obs.id | The observation parameter ID. |
obs.times | A vector for observation times. Usually
this is |
obs.data | An array for observation data. Usually
this is |
anen.times | A vector for AnEn test times. |
anen.flts | A vector for AnEn flts. |
anen.data | An 4-dimensional array for analogs. |
fcst.id | The forecast parameter ID. |
fcst.times | A vector for forecast times. Usually
this is |
fcst.flts | A vector for forecast flts. Usually
this is |
fcst.data | An array for forecast data. Usually
this is |
max.flt | The cut off point value for both forecasts and AnEn lead times. |
origin | The origin for as.POSIXct |
tz | The tz for as.POSIXct |
y.lab | The variable name to be shown on figures. |
return.data | Whether to return the plot data so that you can generate your own plots. This will suppress plotting the figure inside this function. |
legend.names | The names to use in the legend. It must be a named vector. |
color.func.line | The |
color.func.shade | The |
If return.data
is TRUE, a list with two
data frames is returned; otherwise, it returns a ggplot
object.
Sometimes, it is helpful to plot forecasts and observations for a long time series. However, this is always limited by forecast lead times because the lead times are usually for several days. What if we want to plot a time series that spans longer than that?
This function generates a plot for that purpose. It simply stacks forecasts from different days and all forecasts lead times. Overlapping lead times will be cut off and earlier lead times will be preferred and kept.