Spaces:
Sleeping
Sleeping
Update charts.py
Browse files
charts.py
CHANGED
|
@@ -10,9 +10,9 @@ import numpy as np
|
|
| 10 |
|
| 11 |
# Shared theme — Light Professional
|
| 12 |
DARK_BG = "#f4f7fb" # used as bar border / contrast edge
|
| 13 |
-
CARD_BG = "#
|
| 14 |
BORDER = "#dde3ed"
|
| 15 |
-
TEXT_MAIN = "#
|
| 16 |
TEXT_DIM = "#7b7b7b" # Flat Grey
|
| 17 |
PRIMARY = "#269ccc" # Optimism Blue
|
| 18 |
ALGAE = "#9ed2c5" # Blue Algae
|
|
@@ -24,8 +24,8 @@ PURPLE = "#7c3aed"
|
|
| 24 |
BLUE = "#2563eb"
|
| 25 |
|
| 26 |
PLOTLY_LAYOUT = dict(
|
| 27 |
-
paper_bgcolor="rgba(
|
| 28 |
-
plot_bgcolor="rgba(
|
| 29 |
font=dict(family="'DM Sans', 'Nunito', sans-serif", color=TEXT_MAIN, size=12),
|
| 30 |
margin=dict(l=20, r=20, t=40, b=20),
|
| 31 |
)
|
|
@@ -136,7 +136,7 @@ def keyword_bar(
|
|
| 136 |
),
|
| 137 |
text=[f"{w:.0f}" for w in weights],
|
| 138 |
textposition="inside",
|
| 139 |
-
textfont=dict(size=10, color="#
|
| 140 |
hovertemplate="<b>%{y}</b><br>Weight: %{text}<extra></extra>",
|
| 141 |
))
|
| 142 |
fig.update_layout(
|
|
@@ -147,7 +147,7 @@ def keyword_bar(
|
|
| 147 |
showgrid=True, gridwidth=1),
|
| 148 |
xaxis=dict(showticklabels=False, gridcolor=BORDER, showgrid=False),
|
| 149 |
bargap=0.3,
|
| 150 |
-
plot_bgcolor="rgba(
|
| 151 |
)
|
| 152 |
return fig
|
| 153 |
|
|
@@ -276,11 +276,11 @@ def modality_misinfo_distribution(modality_analysis: Dict) -> go.Figure:
|
|
| 276 |
orientation="h",
|
| 277 |
y=1.12,
|
| 278 |
font=dict(size=11),
|
| 279 |
-
bgcolor="rgba(
|
| 280 |
),
|
| 281 |
bargap=0.22,
|
| 282 |
bargroupgap=0.06,
|
| 283 |
-
plot_bgcolor="rgba(
|
| 284 |
)
|
| 285 |
return fig
|
| 286 |
|
|
@@ -357,7 +357,7 @@ def trust_score_by_modality(modality_analysis: Dict) -> go.Figure:
|
|
| 357 |
ticksuffix="%",
|
| 358 |
),
|
| 359 |
bargap=0.38,
|
| 360 |
-
plot_bgcolor="rgba(
|
| 361 |
)
|
| 362 |
return fig
|
| 363 |
|
|
@@ -446,7 +446,7 @@ def uncertainty_analysis(modality_analysis: Dict) -> go.Figure:
|
|
| 446 |
ticksuffix="%",
|
| 447 |
),
|
| 448 |
bargap=0.38,
|
| 449 |
-
plot_bgcolor="rgba(
|
| 450 |
)
|
| 451 |
return fig
|
| 452 |
|
|
@@ -497,8 +497,8 @@ def sentiment_timeline(comments_df: pd.DataFrame, sentiments: List[Dict]) -> go.
|
|
| 497 |
yaxis=dict(title="Compound score", gridcolor=BORDER, range=[-1.1, 1.1],
|
| 498 |
showgrid=True, gridwidth=1),
|
| 499 |
legend=dict(orientation="h", y=1.12, font=dict(size=11),
|
| 500 |
-
bgcolor="rgba(
|
| 501 |
-
plot_bgcolor="rgba(
|
| 502 |
)
|
| 503 |
return fig
|
| 504 |
|
|
@@ -551,9 +551,9 @@ def keyword_comparison(
|
|
| 551 |
xaxis=dict(title="← Negatively Engagement | Positively Engagement →", gridcolor=BORDER,
|
| 552 |
zeroline=True, zerolinecolor=BORDER, zerolinewidth=2),
|
| 553 |
yaxis=dict(tickfont=dict(size=10)),
|
| 554 |
-
legend=dict(orientation="h", y=1.1, bgcolor="rgba(
|
| 555 |
bordercolor=BORDER, borderwidth=1),
|
| 556 |
-
plot_bgcolor="rgba(
|
| 557 |
)
|
| 558 |
return fig
|
| 559 |
|
|
@@ -565,5 +565,5 @@ def _empty_fig(title: str) -> go.Figure:
|
|
| 565 |
fig.add_annotation(text="No data available", x=0.5, y=0.5, showarrow=False,
|
| 566 |
font=dict(size=14, color=TEXT_DIM))
|
| 567 |
fig.update_layout(**PLOTLY_LAYOUT, title=dict(text=title, x=0), height=250,
|
| 568 |
-
plot_bgcolor="rgba(
|
| 569 |
return fig
|
|
|
|
| 10 |
|
| 11 |
# Shared theme — Light Professional
|
| 12 |
DARK_BG = "#f4f7fb" # used as bar border / contrast edge
|
| 13 |
+
CARD_BG = "#f4deb4"
|
| 14 |
BORDER = "#dde3ed"
|
| 15 |
+
TEXT_MAIN = "#b09561"
|
| 16 |
TEXT_DIM = "#7b7b7b" # Flat Grey
|
| 17 |
PRIMARY = "#269ccc" # Optimism Blue
|
| 18 |
ALGAE = "#9ed2c5" # Blue Algae
|
|
|
|
| 24 |
BLUE = "#2563eb"
|
| 25 |
|
| 26 |
PLOTLY_LAYOUT = dict(
|
| 27 |
+
paper_bgcolor="rgba(244,222,180,0)",
|
| 28 |
+
plot_bgcolor="rgba(244,222,180,0)",
|
| 29 |
font=dict(family="'DM Sans', 'Nunito', sans-serif", color=TEXT_MAIN, size=12),
|
| 30 |
margin=dict(l=20, r=20, t=40, b=20),
|
| 31 |
)
|
|
|
|
| 136 |
),
|
| 137 |
text=[f"{w:.0f}" for w in weights],
|
| 138 |
textposition="inside",
|
| 139 |
+
textfont=dict(size=10, color="#f4deb4", family="'DM Sans', sans-serif"),
|
| 140 |
hovertemplate="<b>%{y}</b><br>Weight: %{text}<extra></extra>",
|
| 141 |
))
|
| 142 |
fig.update_layout(
|
|
|
|
| 147 |
showgrid=True, gridwidth=1),
|
| 148 |
xaxis=dict(showticklabels=False, gridcolor=BORDER, showgrid=False),
|
| 149 |
bargap=0.3,
|
| 150 |
+
plot_bgcolor="rgba(212,193,162,0.6)",
|
| 151 |
)
|
| 152 |
return fig
|
| 153 |
|
|
|
|
| 276 |
orientation="h",
|
| 277 |
y=1.12,
|
| 278 |
font=dict(size=11),
|
| 279 |
+
bgcolor="rgba(244,222,180,0)",
|
| 280 |
),
|
| 281 |
bargap=0.22,
|
| 282 |
bargroupgap=0.06,
|
| 283 |
+
plot_bgcolor="rgba(212,193,162,0.6)",
|
| 284 |
)
|
| 285 |
return fig
|
| 286 |
|
|
|
|
| 357 |
ticksuffix="%",
|
| 358 |
),
|
| 359 |
bargap=0.38,
|
| 360 |
+
plot_bgcolor="rgba(212,193,162,0.6)",
|
| 361 |
)
|
| 362 |
return fig
|
| 363 |
|
|
|
|
| 446 |
ticksuffix="%",
|
| 447 |
),
|
| 448 |
bargap=0.38,
|
| 449 |
+
plot_bgcolor="rgba(212,193,162,0.6)",
|
| 450 |
)
|
| 451 |
return fig
|
| 452 |
|
|
|
|
| 497 |
yaxis=dict(title="Compound score", gridcolor=BORDER, range=[-1.1, 1.1],
|
| 498 |
showgrid=True, gridwidth=1),
|
| 499 |
legend=dict(orientation="h", y=1.12, font=dict(size=11),
|
| 500 |
+
bgcolor="rgba(244,222,180,0.8)", bordercolor=BORDER, borderwidth=1),
|
| 501 |
+
plot_bgcolor="rgba(212,193,162,0.6)",
|
| 502 |
)
|
| 503 |
return fig
|
| 504 |
|
|
|
|
| 551 |
xaxis=dict(title="← Negatively Engagement | Positively Engagement →", gridcolor=BORDER,
|
| 552 |
zeroline=True, zerolinecolor=BORDER, zerolinewidth=2),
|
| 553 |
yaxis=dict(tickfont=dict(size=10)),
|
| 554 |
+
legend=dict(orientation="h", y=1.1, bgcolor="rgba(244,222,180,0.8)",
|
| 555 |
bordercolor=BORDER, borderwidth=1),
|
| 556 |
+
plot_bgcolor="rgba(244,222,180,0.6)",
|
| 557 |
)
|
| 558 |
return fig
|
| 559 |
|
|
|
|
| 565 |
fig.add_annotation(text="No data available", x=0.5, y=0.5, showarrow=False,
|
| 566 |
font=dict(size=14, color=TEXT_DIM))
|
| 567 |
fig.update_layout(**PLOTLY_LAYOUT, title=dict(text=title, x=0), height=250,
|
| 568 |
+
plot_bgcolor="rgba(212,193,162,0.6)")
|
| 569 |
return fig
|