powellgenomicslab / Nebulosa

R package to visualize gene expression data based on weighted kernel density estimation
89 stars 8 forks source link

Introduce split.by? #5

Open kmshort opened 4 years ago

kmshort commented 4 years ago

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.

shaniAmare commented 1 year ago

I agree too!