Skip to content

sc.pl.umap does not show legend when show=False and saving figure manually #3926

@lihaowhusos

Description

@lihaowhusos

Please make sure these conditions are met

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of scanpy.
  • (optional) I have confirmed this bug exists on the main branch of scanpy.

What happened?

Hi! I encountered an issue when using sc.pl.umap with show=False and then saving the figure manually. The resulting PDF does not include the legend, even though a legend is shown when show=True.

T_NK_leiden_res_3.00_cluster_3_umap.pdf

Minimal code sample

sc.pl.umap(mdata['gex'], color='cluster_3',show=False).figure.savefig('/mnt/UMAP/T_NK/T_NK_leiden_res_3.00_cluster_3_umap.pdf')

Error output

Versions

Python | 3.10.18 | packaged by conda-forge | (main, Jun 4 2025, 14:45:41) [GCC 13.3.0]

OS | Linux-5.4.0-216-generic-x86_64-with-glibc2.31

Dependency Version
scanpy 1.11.4
joblib 1.5.2
numba 0.62.1
umap-learn 0.5.9.post2
patsy 1.0.1
pure_eval 0.2.3
jedi 0.19.2
importlib_metadata 8.7.0
adjustText 1.3.0
six 1.17.0
PyYAML 6.0.3
igraph 0.11.9
future 1.0.0
h5py 3.14.0
ipywidgets 8.1.8
statsmodels 0.14.5
debugpy 1.8.17
pytz 2025.2
url-normalize 2.2.1
wcwidth 0.2.14
python-dateutil 2.9.0.post0
pynndescent 0.5.13
stack-data 0.6.3
tqdm 4.67.1
pyarrow 22.0.0
zipp 3.23.0
asttokens 3.0.0
pooch 1.8.2 (v1.8.2)
kiwisolver 1.4.9
Cython 3.1.4
tornado 6.5.2
setuptools 80.9.0
charset-normalizer 3.4.3
requests 2.32.5
leidenalg 0.10.2
natsort 8.4.0
prompt_toolkit 3.0.52
executing 2.2.1
plotly 6.5.0
certifi 2025.8.3 (2025.08.03)
ipython 8.37.0
pillow 11.3.0
llvmlite 0.45.1
psutil 7.1.0
parso 0.8.5
texttable 1.7.0
networkx 3.4.2
decorator 5.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Triage 🩺This issue needs to be triaged by a maintainer

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions