From 1e76a82f2444aa94b1fd9af0d69b6954f3489a4e Mon Sep 17 00:00:00 2001 From: Luigi Maiorano Date: Tue, 3 Feb 2026 17:41:12 +0100 Subject: [PATCH] fix wordcloud filter values --- plots.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plots.py b/plots.py index 2321c68..5abf602 100644 --- a/plots.py +++ b/plots.py @@ -2,6 +2,7 @@ import re import math +import textwrap from pathlib import Path import altair as alt @@ -1349,9 +1350,14 @@ class QualtricsPlotsMixin: # Add title with filter subtitle (similar to _add_filter_footnote for Altair charts) filter_text = self._get_filter_description() if filter_text: - # Title on top, filter subtitle below in light grey - fig.suptitle(title, fontsize=16, y=0.98, color=ColorPalette.TEXT) - ax.set_title(filter_text, fontsize=10, pad=10, color='lightgrey', loc='left') + # Wrap filter text to prevent excessively long lines + wrapped_lines = textwrap.wrap(filter_text, width=100) + wrapped_text = '\n'.join(wrapped_lines) + + # Use suptitle for main title (auto-positioned above axes) + fig.suptitle(title, fontsize=16, color=ColorPalette.TEXT, y=1.02) + # Use ax.set_title for filter text (positioned relative to axes, not figure) + ax.set_title(wrapped_text, fontsize=10, color='lightgrey', loc='left', pad=5) else: ax.set_title(title, fontsize=16, pad=20, color=ColorPalette.TEXT)