Skip to contents

This function plots a point cloud (X, Y) and the two marginal distributions

Usage

plot_qc_facslike(
  df,
  x = "nFeature_RNA",
  y = "log_nCount_RNA",
  col_by = "orig.ident",
  col_colors = "custom",
  x_thresh = NULL,
  y_thresh = NULL,
  bins = 30
)

Arguments

df

DATAFRAME : For instance, it could be sobj@meta.data (no default)

x

CHARACTER : a numeric column name in df, to plot as x-axis (default to "nFeature_RNA")

y

CHARACTER : a numeric column name in df, to plot as y-axis (default to "log_nCount_RNA")

col_by

CHARACTER : a column name in df, to color point by. It could be a discrete or continuous. Set NULL to (default to "orig.ident")

col_colors

VECTOR : a color vector, which can be named if col_by is discrete. If NULL, one can set custom colors by adding layers to the ggplot object. By default, it uses aquarius::palette_GrOrBl palette for continuous values, and default ggplot palette for discrete values (default to "custom")

x_thresh

NUMERIC : one numeric value to add a vertical line on the figure (default to NULL)

y_thresh

NUMERIC : one numeric value to add a horizontal line on the figure (default to NULL)

bins

NUMERIC : number of bins for histograms (default to c(30, 30))

Value

A figure arranged with patchwork

Examples

if (FALSE) { # \dontrun{
set.seed(1234)
df = data.frame(xval = rnorm(n = 1000, mean = 1, sd = 2),
                yval = rnorm(n = 1000, mean = 0, sd = 1),
                sample = unlist(lapply(LETTERS[c(1:5)], FUN = rep, times = 200)))
df$sample = as.factor(df$sample)

plot_qc_facslike(df,
                 x = "xval",
                 y = "yval",
                 col_by = "sample",
                 x_thresh = 1/3,
                 y_thresh = -2/3,
                 bins = 30)
} # }