From bbaacaa230eea3211d1485e78994a8e0b4046bb1 Mon Sep 17 00:00:00 2001 From: Philipp Niedermayer <p.niedermayer@gsi.de> Date: Wed, 25 May 2022 13:51:07 +0200 Subject: [PATCH] Labeling --- plotting.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plotting.py b/plotting.py index 95d6392..93683c6 100644 --- a/plotting.py +++ b/plotting.py @@ -73,11 +73,14 @@ def subplot_shared_labels(axes, xlabel=None, ylabel=None, clear=True): """ for r in range(axes.shape[0]): for c in range(axes.shape[1]): - if clear: axes[r,c].set(xlabel=None, ylabel=None) - if c == 0 or not axes[r,c].get_shared_y_axes().joined(axes[r,c], axes[r,0]): - axes[r,c].set(ylabel=ylabel) - if r == axes.shape[0]-1 or not axes[r,c].get_shared_x_axes().joined(axes[r,c], axes[-1,c]): - axes[r,c].set(xlabel=xlabel) + if ylabel: + if clear: axes[r,c].set(ylabel=None) + if c == 0 or not axes[r,c].get_shared_y_axes().joined(axes[r,c], axes[r,0]): + axes[r,c].set(ylabel=ylabel) + if xlabel: + if clear: axes[r,c].set(xlabel=None) + if r == axes.shape[0]-1 or not axes[r,c].get_shared_x_axes().joined(axes[r,c], axes[-1,c]): + axes[r,c].set(xlabel=xlabel) def grid_diagonal(ax, **kwargs): for k, v in dict(color='lightgray',lw=1,zorder=-100).items(): -- GitLab