R/plot_curves_by_trat.R

Defines functions plot_curves_by_trat

Documented in plot_curves_by_trat

#' Plot treatment-specific curves over time
#'
#' @param data Data frame containing the columns `trat`, `time`, and `y`.
#' @return A ggplot object.
#' @export
plot_curves_by_trat <- function(data) {
  stopifnot(all(c('trat','time','y') %in% names(data)))
  ggplot2::ggplot(data, ggplot2::aes(x = .data$time, y = .data$y, color = .data$trat, group = .data$trat)) +
    ggplot2::geom_line() +
    ggplot2::geom_point() +
    ggplot2::labs(x = 'Time', y = 'Index/Response', color = 'Treatment') +
    ggplot2::theme_minimal()
}

Try the infectionIndex package in your browser

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

infectionIndex documentation built on Dec. 4, 2026, 5:10 p.m.