From cab143ce8a25b5d7d3a8dfc8d89995abc5825320 Mon Sep 17 00:00:00 2001 From: George Dang <53052793+gtdang@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:18:17 -0400 Subject: [PATCH] fix: removed tight_layout method in favor of the constrained layout argument The tight layout was displaying a warning for spectrogram plots. This change removes that message. --- hnn_core/gui/_viz_manager.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/hnn_core/gui/_viz_manager.py b/hnn_core/gui/_viz_manager.py index 8be8f62db..c260f5bac 100644 --- a/hnn_core/gui/_viz_manager.py +++ b/hnn_core/gui/_viz_manager.py @@ -333,14 +333,12 @@ def _static_rerender(widgets, fig, fig_idx): fig_output = widgets['figs_tabs'].children[fig_tab_idx] fig_output.clear_output() with fig_output: - fig.tight_layout() display(fig) def _dynamic_rerender(fig): fig.canvas.draw() fig.canvas.flush_events() - fig.tight_layout() def _avg_dipole_check(dpls): @@ -758,13 +756,10 @@ def _add_figure(b, widgets, data, template_type, scale=0.95, dpi=96): scale * ((int(viz_output_layout.height[:-2]) - 10) / dpi)) mosaic = template_type['mosaic'] kwargs = template_type['kwargs'] - plt.ioff() - fig, axd = plt.subplot_mosaic(mosaic, - figsize=figsize, - dpi=dpi, - **kwargs) - plt.ion() - fig.tight_layout() + with plt.ioff(): + fig = plt.figure(figsize=figsize, dpi=dpi, layout='constrained') + axd = fig.subplot_mosaic(mosaic, **kwargs) + fig.canvas.header_visible = False fig.canvas.footer_visible = False