This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Splitting a Nebulosa (Seurat wrapper) visualization by treatment group

In the Seurat wrapper-package "Nebulosa," is there a way to split a plot_density() visualization by e.g. treatment groups, like, for example, the "split.by" option in Seurat's FeaturePlot()? I have been looking through the documentation but haven't found anything explicit. If not, how might I (a very basic R user) be able to achieve this? For reference, I have linked the plot_density() documentation here (https://rdrr.io/bioc/Nebulosa/man/plot_density.html).

nebulosa seurat plot_density

2 answers

plot_density() is returning a ggplot2 object, so you can actually modify using that system, for instance facet_grid() or facet_wrap()

plot_density(SeuratObj, "feature") + 
    facet_grid(.~SeuratObj$variable)

enter image description here

@theHumanBorch this is perfect, thank you!

Doesn't appear possible with that package. You can get something similar with dittoSeq's dittoDimHex function, but it won't be using a kernel density estimate or any sort of imputation, just binning cells and displaying median, average, total expression, etc.

It has a typical split.by argument for faceting.

Log in to answer this question.