diff --git a/R/plotAbundanceDensity.R b/R/plotAbundanceDensity.R index 9c45c369..b97e9c3e 100644 --- a/R/plotAbundanceDensity.R +++ b/R/plotAbundanceDensity.R @@ -83,6 +83,9 @@ #' #' @author Leo Lahti and Tuomas Borman. Contact: \url{microbiome.github.io} #' +#' @seealso +#' \code{\link[scater:plotExpression]{scater::plotExpression}} +#' #' @examples #' data("peerj13075", package = "mia") #' tse <- peerj13075 @@ -127,6 +130,16 @@ #' # to your wishes #' plotAbundanceDensity( #' tse, assay.type = "relabundance", decreasing = NA) +#' +#' # Box plots and violin plots are supported by scater::plotExpression. +#' # Plots the relative abundance of 5 most abundant taxa as a violin plot. +#' library(scater) +#' top <- getTop(tse, top = 5) +#' plotExpression(tse, features = top, assay.type = "relabundance") + ggplot2::coord_flip() +#' +#' # Plots the relative abundance of 5 most abundant taxa as a box plot. +#' plotExpression(tse, features = top, assay.type = "relabundance", +#' show_violin = FALSE, show_box = TRUE) + ggplot2::coord_flip() #' NULL @@ -388,4 +401,4 @@ setMethod("plotAbundanceDensity", signature = c(x = "SummarizedExperiment"), add_x_text = TRUE, angle_x_text = angle_x_text) return(plot_out) -} +} \ No newline at end of file diff --git a/man/plotAbundanceDensity.Rd b/man/plotAbundanceDensity.Rd index ea6d5404..736e7f47 100644 --- a/man/plotAbundanceDensity.Rd +++ b/man/plotAbundanceDensity.Rd @@ -157,6 +157,19 @@ plotAbundanceDensity( plotAbundanceDensity( tse, assay.type = "relabundance", decreasing = NA) +# Box plots and violin plots are supported by scater::plotExpression. +# Plots the relative abundance of 5 most abundant taxa as a violin plot. +library(scater) +top <- getTop(tse, top = 5) +plotExpression(tse, features = top, assay.type = "relabundance") + ggplot2::coord_flip() + +# Plots the relative abundance of 5 most abundant taxa as a box plot. +plotExpression(tse, features = top, assay.type = "relabundance", + show_violin = FALSE, show_box = TRUE) + ggplot2::coord_flip() + +} +\seealso{ +\code{\link[scater:plotExpression]{scater::plotExpression}} } \author{ Leo Lahti and Tuomas Borman. Contact: \url{microbiome.github.io}