Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/dev/14319.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix :meth:`mne.Evoked.plot_joint` interactive plots, where the axes shrank to zero when moving the cursor over the figure (the connection lines between the time series and topomaps were inflating the constrained layout, shrinking the axes on every redraw), by `Akhil Gopu`_.
1 change: 1 addition & 0 deletions doc/changes/names.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.. _Adeline Fecker: https://github.com/adelinefecker
.. _Adina Wagner: https://github.com/adswa
.. _Adonay Nunes: https://github.com/AdoNunes
.. _Akhil Gopu: https://github.com/AkhilG-exe
.. _Akhilesh S. Yadav: https://github.com/YadavAkhileshh
.. _Akshay: https://github.com/Akshay0724
.. _Alan Leggitt: https://github.com/leggitta
Expand Down
4 changes: 4 additions & 0 deletions mne/viz/evoked.py
Original file line number Diff line number Diff line change
Expand Up @@ -2372,6 +2372,10 @@ def plot_evoked_joint(
zorder=1,
clip_on=False,
)
# The lines intentionally poke outside of `ts_ax`, so keep them out of the
# layout bbox reckoning; otherwise constrained layout grows the margin on
# every redraw, shrinking the axes to nothing (see #14317).
con.set_in_layout(False)
ts_ax.add_artist(con)

# mark times in time series plot
Expand Down
10 changes: 9 additions & 1 deletion mne/viz/tests/test_topo.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,15 @@ def _get_epochs_delayed_ssp():
def test_plot_joint():
"""Test joint plot."""
evoked = _get_epochs().average()
evoked.plot_joint(ts_args=dict(time_unit="s"), topomap_args=dict(time_unit="s"))
fig = evoked.plot_joint(
picks="grad", ts_args=dict(time_unit="s"), topomap_args=dict(time_unit="s")
)
ax = max(fig.axes, key=lambda a: a.get_position().height)
fig.canvas.draw()
pos = ax.get_position().bounds
for _ in range(5):
fig.canvas.draw()
assert np.allclose(pos, ax.get_position().bounds)

def return_inds(d): # to test function kwarg to zorder arg of evoked.plot
return list(range(d.shape[0]))
Expand Down