R/plot_v.R

Defines functions plot_v

Documented in plot_v

#' Calculate distances of Tn5 insertions from motif.
#' 
#' @param df A data.frame returned from funciton calc_v.
#' @param ... Arguments for geom_point in ggplot.
#' @param size Numeric. Point size. 
#' @param alpha Numeric value between 0 and 1. Point transparency. 
#' @return An object of class 'ggplot'.
#' @import ggplot2
#' @export
plot_v <- function(df, size=1, alpha=0.01, ...){
        # plot the data
        gg <- ggplot2::ggplot(df, aes(x = df[ ,2], y = df[ ,1])) +        
                geom_point(alpha=alpha, size=size, ...) +
                scale_x_continuous(expand = c(0, 0)) + 
                scale_y_continuous(expand = c(0, 0)) +
                xlab("Distance from motif") +
                ylab("Fragment length") +
                theme_bw() +
                theme(panel.grid.major = element_blank(), 
                      panel.grid.minor = element_blank())
        
        return(gg)
}
SamBuckberry/RunATAC documentation built on Aug. 2, 2021, 9:54 a.m.