R/Qplot.R

Defines functions Qplot

Documented in Qplot

#' Discharge Plot
#'
#' @param data List. Entries are the rivers measuring stations.
#'
#'
#'
#' @param station  Data frame in list consisting of two columns. First column is the date of the measurement (first row is oldest measurement). The second column is the measured Value of the Discharge of that date.
#'
#'
#'
#' @return ggplot (Value ~ Date)
#' @export
#'
#' @examples
#'
#'
#'
#'
#'
Qplot=function(data, station ){

  # grab data.frame from list
  nbr=which(names(data)==station)
  # Information for the description of the plot
  minDate= data[[nbr]][1,1]
  l=length(data[[nbr]][,1])
  maxDate=data[[nbr]][l,1]
  #provide the title
  titl=paste("Discharge: ",data , station , "from", minDate,"to", maxDate)

  plot= ggplot()+geom_line(data[[nbr]], mapping=aes(x=data[[nbr]][,1],y=data[[nbr]][,2], group=1, col="red"))+scale_x_date(name="Date")+labs(title=titl, subtitle="From the GRDC-Data by the BfG (Germany)")+theme(legend.position="none")
  return(plot)
}
maibrittbergh/clydrol documentation built on Dec. 21, 2021, 1:43 p.m.