0

The following function:

hydrograph(df, streamflow = df$`Q (m3/s)` , timeSeries = df$`Sampling time`,
           precip = df$`Rainfall mm`, begin = 1,
           endindex = length(streamflow), P.units = "mm", S.units = "m3/s",
           stream.label = "Streamflow")

results into: Hydrograph

This function allows me to plot certain time ranges using begin and endindex. My problem is that I want to plot from the 13/07/2021 00:15:00 to 27/07/2021 18:00:00 (this date's range is the length of the streamflow data) and I don't seem to get it right. I have tried.
a) endindex = length(streamflow)
b) begin = "13/07/2021 00:15:00", endindex = "27/07/2021 18:00:00"

Drop
  • 119
  • 7
  • You should provide [data and libraries](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – jay.sf Feb 07 '22 at 12:46

1 Answers1

1

If you don't mind using the tidyverse framework, you can pre-filter your stream before passing it to the plotting function:

library(dplyr)
library(EcoHydRology)
df |>
   filter(`Sampling time` >= as.Date("13/07/2021 00:15:00"),
          `Sampling time` <= as.Date("27/07/2021 18:00:00")) |> 
   with(hydrograph(streamflow = `Q (m3/s)` , 
                   timeSeries = `Sampling time`,
                   precip = `Rainfall mm`, 
                   P.units = "mm", 
                   S.units = "m3/s",
                   stream.label = "Streamflow")
Stefano Barbi
  • 2,978
  • 1
  • 12
  • 11