1 2 3 4 5 6 7 8 9 10 11 12 13
| f_umap_density2d <- function(umapdata){ ret = ggplot() + geom_point(data = umapdata,aes(x=UMAP_1, y=UMAP_2, colour = ident)) for (o_ident in levels(umapdata$ident)){ tmpdata = subset(umapdata, ident == o_ident) ret = ret + stat_density2d(data = tmpdata, mapping = aes(x=UMAP_1, y=UMAP_2)) } ret }
f_umap_density2d_ <- function(sObject){ p_umap <- DimPlot(sObject, reduction = "umap") f_umap_density2d(p_umap$data) + p_umap$theme }
|