Skip to content

Commit 9883246

Browse files
Backport PR #3771 on branch 1.11.x (fix: Ignore NaNs when calculating scatter plot dot size) (#3858)
Co-authored-by: MLubetzki <[email protected]>
1 parent 7de48fb commit 9883246

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/scanpy/plotting/_tools/scatterplots.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ def embedding( # noqa: PLR0912, PLR0913, PLR0915
225225
):
226226
size = np.array(size, dtype=float)
227227
else:
228-
size = 120000 / adata.shape[0]
228+
# if the basis has NaNs, ignore the corresponding cells for size calcluation
229+
size = 120000 / (~np.isnan(basis_values).any(axis=1)).sum()
229230

230231
##########
231232
# Layout #

0 commit comments

Comments
 (0)