From c6b799e03bfb103f789c833c3baf42af35013a06 Mon Sep 17 00:00:00 2001 From: he weilin Date: Mon, 6 Jan 2025 17:10:21 +0800 Subject: [PATCH] Fix the height_ratios of each subplot --- darts/ad/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/darts/ad/utils.py b/darts/ad/utils.py index d0e3fb4a3b..bc3588cb77 100644 --- a/darts/ad/utils.py +++ b/darts/ad/utils.py @@ -459,11 +459,13 @@ def show_anomalies_from_scores( plots_per_ts = nbr_plots * series_width if multivariate_plot else nbr_plots fig, axs = plt.subplots( plots_per_ts, - figsize=(8, 4 + 2 * (plots_per_ts - 1)), + figsize=(8, 4 * (plots_per_ts // nbr_plots) + 2 * (nbr_plots - 1)), sharex=True, - gridspec_kw={"height_ratios": [2] + [1] * (plots_per_ts - 1)}, + gridspec_kw={ + "height_ratios": ([2] + [1] * (nbr_plots - 1)) * (plots_per_ts // nbr_plots) + }, squeeze=False, - constrained_layout=True, + layout="constrained", ) for i in range(series_width if multivariate_plot else 1):