View source: R/composite_score_function.R
| PlotConvergenceDensity | R Documentation |
Draws overlapping density curves of a continuous variable (x_var), split by a convergence-direction column (fill_var).
PlotConvergenceDensity(
seurat_obj,
x_var,
fill_var,
color_var = NULL,
title = NULL,
x_label = NULL,
alpha = 0.6
)
seurat_obj |
Seurat object whose meta.data holds x_var, fill_var, and its matching color column. |
x_var |
Character. Name of the meta.data column holding the continuous variable (e.g. "age"). |
fill_var |
Character. Name of the meta.data column used to fill the density curves. |
color_var |
Character or NULL. Name of the meta.data column holding the hex color. |
title |
Character or NULL. Plot title. |
x_label |
Character or NULL. X-axis label. Defaults to x_var. |
alpha |
Numeric. Transparency of the density fill, between 0 and 1 (default: 0.6). |
A ggplot object.
seu_path <- system.file("extdata", "pbmc3k_subset.rds", package = "ConvergeR")
seu <- readRDS(seu_path)
set.seed(42)
seu$age <- sample(20:70, ncol(seu), replace = TRUE)
seu$Score_IFN <- rnorm(ncol(seu))
seu$Score_Inflam <- rnorm(ncol(seu))
seu <- CalculateConvergedScore(
seurat_obj = seu,
principal_score = "Score_IFN",
other_scores = "Score_Inflam",
output_colname = "Converged_Immune"
)
PlotConvergenceDensity(
seurat_obj = seu,
x_var = "age",
fill_var = "Converged_Immune_Direction",
x_label = "Patient Age"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.