Skip to content

Commit

Permalink
fix: removed tight_layout method in favor of the constrained layout a…
Browse files Browse the repository at this point in the history
…rgument

The tight layout was displaying a warning for spectrogram plots. This change removes that message.
  • Loading branch information
gtdang committed Sep 20, 2024
1 parent 11edf56 commit cab143c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions hnn_core/gui/_viz_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit cab143c

Please sign in to comment.