supposed wordcloud fix, but everything broke
This commit is contained in:
@@ -257,17 +257,17 @@ mo.md(r"""
|
||||
""")
|
||||
|
||||
# %%
|
||||
_pairwise_df, _meta = S.compute_ranking_significance(char_rank)
|
||||
# _pairwise_df, _meta = S.compute_ranking_significance(char_rank)
|
||||
|
||||
# print(_pairwise_df.columns)
|
||||
# # print(_pairwise_df.columns)
|
||||
|
||||
mo.md(f"""
|
||||
# mo.md(f"""
|
||||
|
||||
|
||||
{mo.ui.altair_chart(S.plot_significance_heatmap(_pairwise_df, metadata=_meta))}
|
||||
# {mo.ui.altair_chart(S.plot_significance_heatmap(_pairwise_df, metadata=_meta))}
|
||||
|
||||
{mo.ui.altair_chart(S.plot_significance_summary(_pairwise_df, metadata=_meta))}
|
||||
""")
|
||||
# {mo.ui.altair_chart(S.plot_significance_summary(_pairwise_df, metadata=_meta))}
|
||||
# """)
|
||||
|
||||
# %%
|
||||
mo.md(r"""
|
||||
@@ -463,34 +463,34 @@ mo.md(r"""
|
||||
|
||||
# %%
|
||||
# Compute pairwise significance tests
|
||||
pairwise_df, metadata = S.compute_pairwise_significance(
|
||||
voice_1_10,
|
||||
test_type="mannwhitney", # or "ttest", "chi2", "auto"
|
||||
alpha=0.05,
|
||||
correction="bonferroni" # or "holm", "none"
|
||||
)
|
||||
# pairwise_df, metadata = S.compute_pairwise_significance(
|
||||
# voice_1_10,
|
||||
# test_type="mannwhitney", # or "ttest", "chi2", "auto"
|
||||
# alpha=0.05,
|
||||
# correction="bonferroni" # or "holm", "none"
|
||||
# )
|
||||
|
||||
# View significant pairs
|
||||
# print(pairwise_df.filter(pl.col('significant') == True))
|
||||
# # View significant pairs
|
||||
# # print(pairwise_df.filter(pl.col('significant') == True))
|
||||
|
||||
# Create heatmap visualization
|
||||
_heatmap = S.plot_significance_heatmap(
|
||||
pairwise_df,
|
||||
metadata=metadata,
|
||||
title="Voice Rating Significance<br>(Pairwise Comparisons)"
|
||||
)
|
||||
# # Create heatmap visualization
|
||||
# _heatmap = S.plot_significance_heatmap(
|
||||
# pairwise_df,
|
||||
# metadata=metadata,
|
||||
# title="Voice Rating Significance<br>(Pairwise Comparisons)"
|
||||
# )
|
||||
|
||||
# Create summary bar chart
|
||||
_summary = S.plot_significance_summary(
|
||||
pairwise_df,
|
||||
metadata=metadata
|
||||
)
|
||||
# # Create summary bar chart
|
||||
# _summary = S.plot_significance_summary(
|
||||
# pairwise_df,
|
||||
# metadata=metadata
|
||||
# )
|
||||
|
||||
mo.md(f"""
|
||||
{mo.ui.altair_chart(_heatmap)}
|
||||
# mo.md(f"""
|
||||
# {mo.ui.altair_chart(_heatmap)}
|
||||
|
||||
{mo.ui.altair_chart(_summary)}
|
||||
""")
|
||||
# {mo.ui.altair_chart(_summary)}
|
||||
# """)
|
||||
|
||||
# %%
|
||||
|
||||
|
||||
18
plots.py
18
plots.py
@@ -1305,6 +1305,16 @@ class QualtricsPlotsMixin:
|
||||
# Create frequency dictionary
|
||||
trait_freq = Counter(traits_list)
|
||||
|
||||
# Handle empty data gracefully - return empty figure with message
|
||||
if not trait_freq:
|
||||
fig, ax = plt.subplots(figsize=(width/100, height/100), dpi=100)
|
||||
ax.text(0.5, 0.5, "No trait data available for current filter",
|
||||
ha='center', va='center', fontsize=14, color='gray',
|
||||
transform=ax.transAxes)
|
||||
ax.axis('off')
|
||||
ax.set_title(title, fontsize=16, pad=20, color=ColorPalette.TEXT)
|
||||
return fig
|
||||
|
||||
# Set random seed for color selection
|
||||
random.seed(random_state)
|
||||
|
||||
@@ -1335,6 +1345,14 @@ class QualtricsPlotsMixin:
|
||||
fig, ax = plt.subplots(figsize=(width/100, height/100), dpi=100)
|
||||
ax.imshow(wordcloud, interpolation='bilinear')
|
||||
ax.axis('off')
|
||||
|
||||
# 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')
|
||||
else:
|
||||
ax.set_title(title, fontsize=16, pad=20, color=ColorPalette.TEXT)
|
||||
|
||||
plt.tight_layout(pad=0)
|
||||
|
||||
Reference in New Issue
Block a user