do_BoxPlot | R Documentation |
Generate Box Plots.
do_BoxPlot(
sample,
feature,
group.by = NULL,
split.by = NULL,
assay = NULL,
slot = "data",
font.size = 14,
font.type = "sans",
axis.text.x.angle = 45,
colors.use = NULL,
na.value = "grey75",
plot.title = NULL,
plot.subtitle = NULL,
plot.caption = NULL,
xlab = NULL,
ylab = NULL,
legend.title = NULL,
legend.title.position = "top",
legend.position = "bottom",
boxplot.line.color = "black",
outlier.color = "black",
outlier.alpha = 0.5,
boxplot.linewidth = 0.5,
boxplot.width = NULL,
plot.grid = TRUE,
grid.color = "grey75",
grid.type = "dashed",
flip = FALSE,
order = FALSE,
use_silhouette = FALSE,
use_test = FALSE,
comparisons = NULL,
test = "wilcox.test",
map_signif_level = TRUE,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain"
)
sample |
|
feature |
|
group.by |
|
split.by |
|
assay |
|
slot |
|
font.size |
|
font.type |
|
axis.text.x.angle |
|
colors.use |
|
na.value |
|
plot.title, plot.subtitle, plot.caption |
|
xlab, ylab |
|
legend.title |
|
legend.title.position |
|
legend.position |
|
boxplot.line.color |
|
outlier.color |
|
outlier.alpha |
|
boxplot.linewidth |
|
boxplot.width |
|
plot.grid |
|
grid.color |
|
grid.type |
|
flip |
|
order |
|
use_silhouette |
|
use_test |
|
comparisons |
A list of length-2 vectors. The entries in the vector are either the names of 2 values on the x-axis or the 2 integers that correspond to the index of the columns of interest. |
test |
the name of the statistical test that is applied to the values of
the 2 columns (e.g. |
map_signif_level |
Boolean value, if the p-value are directly written as
annotation or asterisks are used instead. Alternatively one can provide a
named numeric vector to create custom mappings from p-values to annotation:
For example: |
plot.title.face, plot.subtitle.face, plot.caption.face, axis.title.face, axis.text.face, legend.title.face, legend.text.face |
|
A ggplot2 object.
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_BoxPlot", passive = TRUE)
if (isTRUE(value)){
# Consult the full documentation in https://enblacar.github.io/SCpubr-book/
# Define your Seurat object.
sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))
# Basic box plot.
p <- SCpubr::do_BoxPlot(sample = sample,
feature = "nCount_RNA")
p
# Use silhouette style.
p <- SCpubr::do_BoxPlot(sample = sample,
feature = "nCount_RNA",
use_silhouette = TRUE)
p
# Order by mean values.
p <- SCpubr::do_BoxPlot(sample = sample,
feature = "nCount_RNA",
order = TRUE)
p
# Apply second grouping.
sample$orig.ident <- ifelse(sample$seurat_clusters %in% c("0", "1", "2", "3"), "A", "B")
p <- SCpubr::do_BoxPlot(sample = sample,
feature = "nCount_RNA",
split.by = "orig.ident")
p
# Apply statistical tests.
p <- SCpubr::do_BoxPlot(sample = sample,
feature = "nCount_RNA",
group.by = "orig.ident",
use_test = TRUE,
comparisons = list(c("A", "B")))
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.