powellgenomicslab/Nebulosa

Introduce split.by?

Opened this issue · 1 comments

Hi,
Thanks for this very handy tool for cluster exploration. It would be most useful if a "split.by" function could be added to Nebulosa, with behaviour similar to Seurat's split.by options for featureplot & dimplot, where plots can be partitioned by the factors/levels that are provided.
ggplot2 facet_wrap() will take plot_density output and split by factor:
plot_density(someSeuratObject, "CD4") + facet_wrap(someSeuratObject$orig.ident)
but as Nebulosa density is calculated feature-wise for all cells in the object, the Nebulosa viridus overlay is duplicated and overlayed on each facet.
So, something like:
plot_density(someSeuratObject, "CD4", split.by = "orig.ident") would be nice, with densities calculated for each "orig.ident" and overlayed accordingly.
This would be a really nice addition and provide a naming convention from Seurat.

I agree too!