Skip to content

Commit abf205a

Browse files
committed
Use GridStack to simplify layout
1 parent 3174fd8 commit abf205a

File tree

1 file changed

+27
-31
lines changed

1 file changed

+27
-31
lines changed

panel/app.py

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
import numpy as np
88
import pandas as pd
99
import panel as pn
10+
from panel.layout.gridstack import GridStack
1011

1112
import simdec as sd
1213

1314

1415
# panel app
1516
pn.extension(template="material")
1617
pn.extension("tabulator")
18+
pn.extension("gridstack")
1719

1820
pn.config.sizing_mode = "stretch_width"
1921
pn.config.throttled = True
@@ -337,34 +339,28 @@ def tableau_states(res, states):
337339
).servable(area="sidebar")
338340

339341

340-
pn_app = pn.Column(
341-
pn.Row(
342-
pn.Column(
343-
pn.panel(
344-
pn.pane.Matplotlib(
345-
interactive_figure,
346-
tight=True,
347-
format="svg",
348-
sizing_mode="stretch_both",
349-
max_height=500,
350-
height_policy="min",
351-
)
352-
),
353-
pn.Spacer(height=50),
354-
pn.pane.Markdown(si_description, styles={"color": "#0072b5"}),
355-
pn.Column(
356-
interactive_sensitivity_indices_table,
357-
width=400,
358-
max_height=300,
359-
height_policy="min",
360-
),
361-
),
362-
pn.Column(
363-
pn.pane.Markdown(table_description, styles={"color": "#0072b5"}),
364-
pn.panel(interactive_tableau),
365-
pn.Spacer(height=125),
366-
pn.pane.Markdown(states_description, styles={"color": "#0072b5"}),
367-
pn.panel(interactive_tableau_states),
368-
),
369-
),
370-
).servable(title="Simulation Decomposition Dashboard")
342+
gstack = GridStack(sizing_mode="stretch_both", min_height=600)
343+
344+
gstack[0:3, 0:3] = pn.pane.Matplotlib(
345+
interactive_figure,
346+
tight=True,
347+
format="svg",
348+
)
349+
350+
gstack[0:2, 3:5] = pn.Column(
351+
pn.pane.Markdown(table_description, styles={"color": "#0072b5"}),
352+
interactive_tableau,
353+
sizing_mode="stretch_both",
354+
)
355+
356+
gstack[2:3, 3:5] = pn.Column(
357+
pn.pane.Markdown(states_description, styles={"color": "#0072b5"}),
358+
interactive_tableau_states,
359+
)
360+
361+
gstack[3:5, 0:2] = pn.Column(
362+
pn.pane.Markdown(si_description, styles={"color": "#0072b5"}),
363+
interactive_sensitivity_indices_table,
364+
)
365+
366+
gstack.servable(title="Simulation Decomposition Dashboard")

0 commit comments

Comments
 (0)