Skip to content

Commit eb14f7d

Browse files
committed
🎨 Fix choropleth map sizing and positioning - side-by-side layout matching TEST-ENVIRONMENT
1 parent 98fae05 commit eb14f7d

8 files changed

+20
-17
lines changed

‎docs/chart1-supplier-influence.html‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎docs/chart3-defense-systems.html‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎docs/chart4-multi-country-radar.html‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎docs/chart5-priorities-heatmap.html‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎docs/chart7-supplier-connections.html‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎docs/threat-perception-analysis.html‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎geopolitical-dashboard/generate_charts_with_filters.py‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,32 @@
2525

2626

2727
def combine_choropleth_with_chart(fig_chart, chart_title):
28-
"""Combine a chart with a choropleth map overlay."""
28+
"""Combine a chart with a choropleth map in side-by-side layout."""
29+
import plotly.graph_objects as go
2930
from plotly.subplots import make_subplots
3031

3132
fig_choropleth = create_choropleth_map("Geographic Overview")
3233

34+
# Create side-by-side layout (1 row, 2 columns)
3335
combined_fig = make_subplots(
34-
rows=2, cols=1,
36+
rows=1, cols=2,
3537
subplot_titles=("Geographic Overview", chart_title),
36-
specs=[[{"type": "geo"}], [{"type": fig_chart.data[0].type if fig_chart.data else "scatter"}]],
37-
vertical_spacing=0.15
38+
specs=[[{"type": "geo"}, {"type": fig_chart.data[0].type if fig_chart.data else "scatter"}]],
39+
horizontal_spacing=0.12,
40+
column_widths=[0.25, 0.75] # 25% for map, 75% for chart
3841
)
3942

40-
# Add choropleth traces
43+
# Add choropleth traces to left column
4144
for trace in fig_choropleth.data:
4245
combined_fig.add_trace(trace, row=1, col=1)
4346

44-
# Add chart traces
47+
# Add chart traces to right column
4548
for trace in fig_chart.data:
46-
combined_fig.add_trace(trace, row=2, col=1)
49+
combined_fig.add_trace(trace, row=1, col=2)
4750

4851
# Update layout
4952
combined_fig.update_layout(
50-
height=1200,
53+
height=400,
5154
showlegend=True,
5255
title_text=chart_title
5356
)

‎geopolitical-dashboard/pages/choropleth_map.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ def create_choropleth_map(title="Geographic Overview"):
9999
coastlinecolor='rgb(204, 204, 204)',
100100
countrycolor='rgb(204, 204, 204)',
101101
showlakes=True,
102-
lakecolor='rgb(200, 220, 240)',
102+
lakecolor='rgb(255, 255, 255)',
103103
center=dict(lon=70, lat=45),
104104
projection_scale=3
105105
),
106106
title=title,
107-
height=400,
108-
margin=dict(l=0, r=0, t=40, b=0)
107+
height=300,
108+
margin=dict(l=0, r=0, t=0, b=0)
109109
)
110110

111111
return fig

0 commit comments

Comments
 (0)