From 26020cfc17d82877f654c2e2bda4c982dedcd8f0 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Sun, 13 Apr 2025 05:33:15 -0700 Subject: [PATCH 1/2] Allow slider to work properly in Google Colab --- openpmd_viewer/openpmd_timeseries/interactive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpmd_viewer/openpmd_timeseries/interactive.py b/openpmd_viewer/openpmd_timeseries/interactive.py index a190a46..05f9562 100644 --- a/openpmd_viewer/openpmd_timeseries/interactive.py +++ b/openpmd_viewer/openpmd_timeseries/interactive.py @@ -528,7 +528,7 @@ def step_bw(b): display(container_ptcl) # When using %matplotlib widget, display the figures at the end - if matplotlib.get_backend() in ['ipympl', 'widget']: + if matplotlib.get_backend() in ['ipympl', 'widget', 'module://ipympl.backend_nbagg']: # Disable interactive mode # This prevents the notebook from showing the figure # when calling `plt.figure` (unreliable with `%matplotlib widget`) From b491da014058cce32f9a3dea5ab0168797133258 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Sun, 13 Apr 2025 06:53:17 -0700 Subject: [PATCH 2/2] Avoid using Accordion --- openpmd_viewer/openpmd_timeseries/interactive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpmd_viewer/openpmd_timeseries/interactive.py b/openpmd_viewer/openpmd_timeseries/interactive.py index 05f9562..acc46d1 100644 --- a/openpmd_viewer/openpmd_timeseries/interactive.py +++ b/openpmd_viewer/openpmd_timeseries/interactive.py @@ -422,7 +422,7 @@ def step_bw(b): accord1.set_title(1, 'Slice selection') accord1.set_title(2, 'Plotting options') # Complete field container - container_fld = widgets.VBox( children=[accord1, widgets.HBox( + container_fld = widgets.VBox( children=[container_fields, widgets.HBox( children=[fld_refresh_toggle, fld_refresh_button])]) set_widget_dimensions( container_fld, width=370 ) @@ -512,7 +512,7 @@ def step_bw(b): accord2.set_title(1, 'Particle selection') accord2.set_title(2, 'Plotting options') # Complete particle container - container_ptcl = widgets.VBox( children=[accord2, widgets.HBox( + container_ptcl = widgets.VBox( children=[container_ptcl_quantities, widgets.HBox( children=[ptcl_refresh_toggle, ptcl_refresh_button])]) set_widget_dimensions( container_ptcl, width=370 )