From 7f1d48e4e602f02d52a4a4da2112f64621ee9bc3 Mon Sep 17 00:00:00 2001 From: Janis Klaise Date: Wed, 27 Sep 2023 12:08:56 +0100 Subject: [PATCH] Fix plot_pd function to work with matplotlib 3.8.0 changes (#965) * Fix plot_pd function to work with matplotlib 3.8.0 changes * Simplify sharing axes --- alibi/explainers/partial_dependence.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/alibi/explainers/partial_dependence.py b/alibi/explainers/partial_dependence.py index 5cffffeb6..56a628727 100644 --- a/alibi/explainers/partial_dependence.py +++ b/alibi/explainers/partial_dependence.py @@ -1096,8 +1096,10 @@ def _is_categorical(feature): for ax_group in one_way_axs.values(): min_val = min([ax_pd_lim[0] for _, ax_pd_lim in ax_group]) max_val = max([ax_pd_lim[1] for _, ax_pd_lim in ax_group]) - ax_group[0][0].get_shared_y_axes().join(ax_group[0][0], *[ax[0] for ax in ax_group[1:]]) - ax_group[0][0].set_ylim(min_val, max_val) + axs = [ax[0] for ax in ax_group] + for ax in axs[1:]: + ax.sharey(axs[0]) + axs[0].set_ylim(min_val, max_val) fig.set(**fig_kw) return axes