From e762eacc8c1a8628fee2a624e4b5feb03ba07c69 Mon Sep 17 00:00:00 2001 From: Jesko Wagner <35219306+jeskowagner@users.noreply.github.com> Date: Wed, 11 Oct 2023 14:49:36 +0100 Subject: [PATCH] Fix #2681 Checks if current axis is colorbar before trying to set the name --- scanpy/plotting/_tools/scatterplots.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scanpy/plotting/_tools/scatterplots.py b/scanpy/plotting/_tools/scatterplots.py index 871a9aa21..60f97d43b 100644 --- a/scanpy/plotting/_tools/scatterplots.py +++ b/scanpy/plotting/_tools/scatterplots.py @@ -891,6 +891,8 @@ def pca( # edit axis labels in returned figure fig = embedding(adata, 'pca', return_fig=return_fig, **kwargs) for ax in fig.axes: + if ax.get_label() == "": + continue ax.set_xlabel(label_dict[ax.xaxis.get_label().get_text()]) ax.set_ylabel(label_dict[ax.yaxis.get_label().get_text()]) return fig