Every phenoscapR plotting function returns a ggplot object, so you can add themes, facets, or annotations as usual, and they all draw from the global palette system for consistent colours across a figure panel. This gallery shows each one on the bundled example data.
library(phenoscapR)
library(ggplot2)
data(phenoscapR_example)
obj <- phenoscapR_example
obj@meta_data$phenotype <- obj@meta_data$phenotype_true
obj <- NormaliseData(obj, method = "zscore")
# A single tissue for the spatial maps.
a <- obj[obj$sample_id == "tonsil_A", ]
# Cell subsetting invalidates cached local density; compute it on this tissue.
a <- CellDensity(a, radius = 40)
markers <- c("CD20", "CD3", "CD8", "PanCK")ViolinPlot() and BoxPlot()RidgePlot() and HistogramPlot()Reduce marker space and plot it with DimPlot() /
EmbeddingPlot().
# Base SVD is sufficient for this small marker panel and avoids dependence
# on an optional truncated-SVD solver when disconnected groups need PCA init.
obj <- RunUMAP(obj, dims = 10, n_neighbors = 15, seed = 1,
pca_method = "svd", n_threads = 1)
EmbeddingPlot(obj, reduction = "umap", colour_by = "phenotype")Because each plot is a plain ggplot, standard customisation just works:
CellMap(a) +
labs(title = "Tonsil A — phenotype map") +
theme(plot.title = element_text(face = "bold"))The package palette is global. Set it once and every plot follows.
Any viridis-family option works ("viridis",
"inferno", "plasma", "cividis",
"rocket", "mako"):
PaletteDiscrete(), PaletteContinuous(), and
CustomGradient() expose the same colours for use in bespoke
plots.