Small multiple plots for clusters
See original GitHub issue- Additional function parameters / changed functionality / changed defaults?
- New analysis tool: A simple analysis tool you have been using and are missing in
sc.tools
? - New plotting function: A kind of plot you would like to seein
sc.pl
? - External tools: Do you know an existing package that should go into
sc.external.*
? - Other?
Hey @fidelram !
I just wrote something to create small multiples to plot cells in a clustering category. Pretty simple and very useful if you have too many clusters. What do you think of this:
def cluster_small_multiples(adata, clust_key, size=60, frameon=False, legend_loc=None, **kwargs):
tmp = adata.copy()
for i,clust in enumerate(adata.obs[clust_key].cat.categories):
tmp.obs[clust] = adata.obs[clust_key].isin([clust]).astype('category')
tmp.uns[clust+'_colors'] = ['#d3d3d3', adata.uns[clust_key+'_colors'][i]]
sc.pl.umap(tmp, groups=tmp.obs[clust].cat.categories[1:].values, color=adata.obs[clust_key].cat.categories.tolist(), size=size, frameon=frameon, legend_loc=legend_loc, **kwargs)
Example output from:
test = sc.datasets.pbmc68k_reduced()
sc.pp.pca(test)
sc.pp.neighbors(test)
sc.tl.umap(test)
cluster_small_multiples(test, 'bulk_labels')
Could generalize this to different bases via sc.pl.scatter()
. Or is this already implemented somewhere that I’m not aware of? Or maybe it’s too simple to have as a small helper function?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Small multiple plots for clusters · Issue #955 · scverse/scanpy
I just wrote something to create small multiples to plot cells in a clustering category. Pretty simple and very useful if you have...
Read more >Clustering with Multiple Graphs - UT Computer Science
In this paper, we focus on the problem of clustering the vertices based on multiple graphs in both unsupervised and semi-supervised settings. As...
Read more >Clusters in scatter plots (article) - Khan Academy
Sometimes the data points in a scatter plot form distinct groups. These groups are called clusters.
Read more >What are Small Multiples? - Displayr
A small multiple is a data visualization that consists of multiple charts arranged in a grid. This makes it easy to compare the...
Read more >Small multiple - Wikipedia
A small multiple (sometimes called trellis chart, lattice chart, grid chart, or panel chart) is a series of similar graphs or charts using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any keyword suggestion?
groups='all'
as @gokceneraslan suggested?How are the things going now ?