From 527108f283526f534646c4bed94e3d4a766b36e9 Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Wed, 25 Mar 2026 14:51:32 +0100 Subject: [PATCH 1/3] Fix top and bottom clipping --- mne/viz/_mpl_figure.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mne/viz/_mpl_figure.py b/mne/viz/_mpl_figure.py index 47a26047768..d8d9e1d9be2 100644 --- a/mne/viz/_mpl_figure.py +++ b/mne/viz/_mpl_figure.py @@ -367,7 +367,7 @@ def __init__(self, inst, figsize, ica=None, xlabel="Time (s)", **kwargs): # XXX simpler with constrained_layout? (when it's no longer "beta") l_margin = 1.0 r_margin = 0.1 - b_margin = 0.45 + b_margin = 0.65 t_margin = 0.25 scroll_width = 0.25 hscroll_dist = 0.25 @@ -1424,10 +1424,10 @@ def _draw_annotations(self): text = ax.annotate( descr, xy, - xytext=(0, 9), + xytext=(0, -3), textcoords="offset points", ha="center", - va="baseline", + va="top", color=segment_color, ) self.mne.annotation_texts.append(text) From 18a57d4ebfb173a92b13a1784f7b8a0c8241c447 Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Thu, 26 Mar 2026 06:55:26 +0100 Subject: [PATCH 2/3] Add changelog entry --- doc/changes/dev/13787.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changes/dev/13787.bugfix.rst diff --git a/doc/changes/dev/13787.bugfix.rst b/doc/changes/dev/13787.bugfix.rst new file mode 100644 index 00000000000..9cbf372c36b --- /dev/null +++ b/doc/changes/dev/13787.bugfix.rst @@ -0,0 +1 @@ +Fix clipped annotations and x-axis label in :meth:`mne.io.Raw.plot`, by `Clemens Brunner`_. \ No newline at end of file From 07ef170169a2e6f59d0e06978f04579d5eb759f9 Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Thu, 26 Mar 2026 08:01:50 +0100 Subject: [PATCH 3/3] Increase z-order of annotations --- mne/viz/_figure.py | 1 + mne/viz/_mpl_figure.py | 1 + 2 files changed, 2 insertions(+) diff --git a/mne/viz/_figure.py b/mne/viz/_figure.py index 1c93a258dff..2879d57683f 100644 --- a/mne/viz/_figure.py +++ b/mne/viz/_figure.py @@ -107,6 +107,7 @@ def __init__(self, **kwargs): grad=10007, scalebar=10008, vline=10009, + ann_text=10010, ) # additional params for epochs (won't affect raw / ICA) self.mne.epoch_traces = list() diff --git a/mne/viz/_mpl_figure.py b/mne/viz/_mpl_figure.py index d8d9e1d9be2..f298b4b1672 100644 --- a/mne/viz/_mpl_figure.py +++ b/mne/viz/_mpl_figure.py @@ -1429,6 +1429,7 @@ def _draw_annotations(self): ha="center", va="top", color=segment_color, + zorder=self.mne.zorder["ann_text"], ) self.mne.annotation_texts.append(text) self.mne.onscreen_annotations = onscreen_annotations