# Impact of scaling on clustering results and controlling minimum cluster size in Leiden clustering

**URL:** https://discourse.scverse.org/t/impact-of-scaling-on-clustering-results-and-controlling-minimum-cluster-size-in-leiden-clustering/3849
**Category:** scanpy
**Created:** [November 6, 2025, 1:57pm UTC](https://discourse.scverse.org/t/impact-of-scaling-on-clustering-results-and-controlling-minimum-cluster-size-in-leiden-clustering/3849 "2025-11-06T13:57:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![asmlgkj](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/asmlgkj/32/1517_2.png) [@asmlgkj](https://discourse.scverse.org/u/asmlgkj)
#### Post date: [November 6, 2025, 1:57pm UTC](https://discourse.scverse.org/t/impact-of-scaling-on-clustering-results-and-controlling-minimum-cluster-size-in-leiden-clustering/3849/1 "2025-11-06T13:57:50Z")

</div>

Description  
Hi scanpy team,  
I’ve encountered two related issues with clustering that I’d like to understand better:  
Issue 1: Dramatic difference in cluster numbers with/without scaling  
I’m observing a significant discrepancy in the number of clusters depending on whether I apply scaling:

With sc.pp.scale(): 36 clusters  
Without sc.pp.scale(): 11 clusters

Questions:

Why does scaling lead to such a dramatic increase in cluster numbers (more than 3x)?  
Which result should be considered more reliable for downstream analysis?  
What are the best practices for deciding whether to scale before clustering?

Issue 2: Many small clusters with very few cells  
When using sc.tl.leiden(), I’m getting many clusters with very small cell counts (some with only a few dozen cells, or even just a handful of cells).  
Question:

Is there a parameter to control the minimum cluster size or to merge very small clusters automatically?  
What’s the recommended approach to handle these small clusters?

import scanpy as sc  
adata = sc.read\_h5ad(‘a.h5ad’)  
sc.pp.calculate\_qc\_metrics(adata)  
sc.pp.filter\_cells(adata, min\_genes=1)  
sc.pp.normalize\_total(adata)  
sc.pp.log1p(adata)

sc.pp.highly\_variable\_genes(adata, min\_mean=0.0125, max\_mean=3, min\_disp=0.5, n\_top\_genes=3000)

# **sc.pp.scale(adata, zero\_center=False)**

sc.pp.pca(adata)  
sc.pp.neighbors(adata, n\_pcs=30)  
sc.tl.umap(adata)  
sc.tl.leiden(adata, neighbors\_key=“neighbors”, key\_added=“leiden”, resolution=1)  
sc.pl.spatial(adata, color=[‘leiden’], frameon=False, ncols=1, spot\_size=100)

---

<div class="post-metadata">

### Author: ![asmlgkj](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/asmlgkj/32/1517_2.png) [@asmlgkj](https://discourse.scverse.org/u/asmlgkj)
#### Post date: [November 10, 2025, 9:19am UTC](https://discourse.scverse.org/t/impact-of-scaling-on-clustering-results-and-controlling-minimum-cluster-size-in-leiden-clustering/3849/2 "2025-11-10T09:19:14Z")

</div>

can someone help me. thanks a lot
