R/voom.R

Defines functions plot_voom.EList plot_voom

Documented in plot_voom plot_voom.EList

#' Plots the mean-variance trend.
#'
#' This function uses the information stored in the object returned by voom()
#' when called with save.plot = TRUE.
#'
#' @param x Output of voom() function.
#'
#' @return NULL
#' @export
#'
plot_voom <- function(x) {
  UseMethod("plot_voom")
}

#' @rdname plot_voom
#' @export
plot_voom.EList <- function(x) {
  d <- data.frame(x = x$voom.xy$x, y = x$voom.xy$y)
  l <- x$voom.line

  ggplot(d, aes(x, y)) +
    geom_point(size = .1) +
    annotate("line", x = l$x, y = l$y, color = "red", size = 1) +
    labs(x = x$voom.xy$xlab, y = x$voom.xy$ylab, title = "voom: Mean variance trend")
}
ddiez/omisc documentation built on Aug. 14, 2024, 1:19 p.m.