R/plot.calculate.R

Defines functions plot.calculate

Documented in plot.calculate

#' plot function for RTMonitor
#'
#' @param data4plot
#' @param config
#' @param screen.n
#'
#' @return
#' @export
#'
#' @examples
plot.calculate <- function(data4plot, config, screen.n) {
  if (nrow(data4plot) == 0)
    return

  with(data4plot, {
    now <- timepassed[length(timepassed)]
    window.t <- config$window.t

    if (!is.numeric(window.t)) {
      timelim <- NULL

    } else {
      x.lo <- now - window.t
      x.hi <- now
      timelim <- c(x.lo, x.hi)

    }

    screen(screen.n)
    par(mar = config$margin)

    plot(
      timepassed, peak.y,
      type = 'l',
      xlim = timelim,
      main = paste0(marks[2], ' - ', marks[1]),
      xlab = 'time',
      ylab = 'Peak Current'
    )

    points(now, peak.y[length(peak.y)], col = 'red', pch = 16)
  })
}
yanxianUCSB/yxhelper documentation built on April 20, 2020, 4:09 p.m.