Skip to content

Commit 5766024

Browse files
MLubetzkiZethsonflying-sheep
authored
fix: Ignore NaNs when calculating scatter plot dot size (#3771)
Co-authored-by: Lukas Heumos <[email protected]> Co-authored-by: Philipp A. <[email protected]>
1 parent f14aa8b commit 5766024

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
@@ -226,7 +226,8 @@ def embedding( # noqa: PLR0912, PLR0913, PLR0915
226226
):
227227
size = np.array(size, dtype=float)
228228
else:
229-
size = 120000 / adata.shape[0]
229+
# if the basis has NaNs, ignore the corresponding cells for size calcluation
230+
size = 120000 / (~np.isnan(basis_values).any(axis=1)).sum()
230231

231232
##########
232233
# Layout #

0 commit comments

Comments
 (0)