R/plot_results.R

Defines functions plot.hce_results

Documented in plot.hce_results

#' A print method for `hce_results ` objects
#'
#' @param x an object of class `hce_results`.
#' @param ... additional arguments to be passed to [base::plot()] function.
#' @return no return value, called for plotting.
#' @export
#' @md
#' @examples
#' WO <- minWO(N = 100:1000)
#' plot(WO)
#' POW <- powerWO(N = 100:1000, WO = 1.2)
#' plot(POW, ylim = c(0, 1))
plot.hce_results <- function(x, ...){
  x <- attr(x, "res")
  Args <- base::list(...)
  Args[["x"]] <- x$input
  Args[["y"]] <- x$value

  if ( is.null(Args[["xlab"]]) & is.null(Args[["ylab"]])) {
    Args[["xlab"]] <- x$input_name
    Args[["ylab"]] <- x$value_name
  } else if (is.null(Args[["xlab"]])) {
    Args[["xlab"]] <- x$input_name
  } else if (is.null(Args[["ylab"]])) {
    Args[["ylab"]] <- x$value_name
  }


 if (is.null(Args[["type"]])) Args[["type"]] <- "l"

 base::do.call(base::plot, Args)

}

Try the hce package in your browser

Any scripts or data that you put into this service are public.

hce documentation built on Oct. 16, 2024, 9:06 a.m.