fix wordcloud filter values
This commit is contained in:
12
plots.py
12
plots.py
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import math
|
import math
|
||||||
|
import textwrap
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import altair as alt
|
import altair as alt
|
||||||
@@ -1349,9 +1350,14 @@ class QualtricsPlotsMixin:
|
|||||||
# Add title with filter subtitle (similar to _add_filter_footnote for Altair charts)
|
# Add title with filter subtitle (similar to _add_filter_footnote for Altair charts)
|
||||||
filter_text = self._get_filter_description()
|
filter_text = self._get_filter_description()
|
||||||
if filter_text:
|
if filter_text:
|
||||||
# Title on top, filter subtitle below in light grey
|
# Wrap filter text to prevent excessively long lines
|
||||||
fig.suptitle(title, fontsize=16, y=0.98, color=ColorPalette.TEXT)
|
wrapped_lines = textwrap.wrap(filter_text, width=100)
|
||||||
ax.set_title(filter_text, fontsize=10, pad=10, color='lightgrey', loc='left')
|
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:
|
else:
|
||||||
ax.set_title(title, fontsize=16, pad=20, color=ColorPalette.TEXT)
|
ax.set_title(title, fontsize=16, pad=20, color=ColorPalette.TEXT)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user