R/plot_violin.R

Defines functions plot_violin

Documented in plot_violin

#' plot violin
#'
#' Plot a violin plot
#'
#' @param df_ data frame
#' @param mode mode
#'
#' @return
#' @export
#'
#' @examples
plot_violin <- function(df_, mode=1) {
  label_subtype <- NULL
  mutations <- NULL
  median <- NULL
  . <- list()
  status <- NULL

  my_theme <- igfuns::my_theme()

  my_colors_vh <- brewer.pal(n = 9, name = "Set1")
  my_scale_fill_vh <- scale_fill_manual(values=my_colors_vh,
                                        labels=paste0("IGHV", seq(7)))
  ggplot(df_, aes(x=label_subtype, y=mutations, color=label_subtype)) +
    geom_violin() +
    my_theme +
    geom_boxplot(width = 0.1, fill="black", outlier.color = NA) +
    stat_summary(fun.y=median, geom="point", fill="white", shape=21, size=2.5) +
    facet_grid(. ~ status)
}
thierrycnam/igfuns documentation built on May 4, 2020, 3:21 a.m.