plot_densities: Plot sample/feature distributions

View source: R/4_plot.R

plot_densitiesR Documentation

Plot sample/feature distributions

Description

Plot sample/feature distributions

Usage

plot_densities(
  object,
  assay = assayNames(object)[1],
  group,
  fill,
  color = NULL,
  linetype = NULL,
  facet = NULL,
  nrow = NULL,
  ncol = NULL,
  dir = "h",
  scales = "free_y",
  labeller = label_value,
  palette = NULL,
  fixed = list(alpha = 0.8, na.rm = TRUE)
)

plot_sample_densities(
  object,
  assay = assayNames(object)[1],
  group = "sample_id",
  fill = if ("subgroup" %in% svars(object)) "subgroup" else "sample_id",
  color = NULL,
  linetype = NULL,
  n = 100,
  facet = NULL,
  nrow = NULL,
  ncol = NULL,
  dir = "h",
  scales = "free_y",
  labeller = label_value,
  palette = NULL,
  fixed = list(alpha = 0.8, na.rm = TRUE)
)

plot_feature_densities(
  object,
  assay = assayNames(object)[1],
  fill = "feature_id",
  group = fill,
  color = NULL,
  linetype = NULL,
  n = 9,
  facet = NULL,
  nrow = NULL,
  ncol = NULL,
  dir = "h",
  scales = "free",
  labeller = label_value,
  palette = NULL,
  fixed = list(alpha = 0.8, na.rm = TRUE)
)

Arguments

object

SummarizedExperiment

assay

string

group

svar (string)

fill

svar (string)

color

svar (string)

linetype

svar (string)

facet

svar (character vector)

nrow

number of facet rows

ncol

number of facet cols

dir

'h' (horizontal) or 'v' (vertical)

scales

'free', 'fixed', 'free_y'

labeller

e.g. label_value

palette

named character vector

fixed

fixed aesthetics

n

number

Value

ggplot object

See Also

plot_sample_violins, plot_sample_boxplots

Examples

# Data
    file <- system.file('extdata/atkin.metabolon.xlsx', package = 'autonomics')
    object <- read_metabolon(file)
    object %<>% extract(, order(.$subgroup))
    
# Sample distributions
    plot_sample_densities(object)
    plot_sample_violins(  object, facet = 'Time')
    plot_sample_boxplots(object)
    plot_exprs(object)
    plot_exprs(object, dim = 'samples', x = 'subgroup', facet = 'Time')
    
# Feature distributions
    plot_feature_densities(object)
    plot_feature_violins(  object)
    plot_feature_boxplots( object)

bhagwataditya/autonomics documentation built on Dec. 1, 2024, 12:27 a.m.