diff --git a/doc/changes/dev/13481.bugfix.rst b/doc/changes/dev/13481.bugfix.rst new file mode 100644 index 00000000000..a813320885e --- /dev/null +++ b/doc/changes/dev/13481.bugfix.rst @@ -0,0 +1 @@ +Fix bug with :func:`mne.viz.plot_evoked` when using ``gfp="only"`` or ``gfp=True``, by `Michael Straube`_. diff --git a/mne/viz/evoked.py b/mne/viz/evoked.py index 5d57df363be..58265ccd37e 100644 --- a/mne/viz/evoked.py +++ b/mne/viz/evoked.py @@ -727,10 +727,12 @@ def _plot_lines( ) if gfp_only: y_offset = 0.0 + this_ylim = (0, 1.1 * np.max(this_gfp) or 1) else: y_offset = this_ylim[0] this_gfp += y_offset ax.autoscale(False) + ax.set_ylim(this_ylim) ax.fill_between( times, y_offset, diff --git a/tutorials/evoked/30_eeg_erp.py b/tutorials/evoked/30_eeg_erp.py index 9ebfd4e845e..53ff8452578 100644 --- a/tutorials/evoked/30_eeg_erp.py +++ b/tutorials/evoked/30_eeg_erp.py @@ -286,8 +286,8 @@ evk.plot(gfp=True, spatial_colors=True, ylim=dict(eeg=[-12, 12])) # %% -# To plot the GFP by itself, you can pass ``gfp='only'`` (this makes it easier -# to read off the GFP data values, because the scale is aligned): +# To plot the GFP by itself, you can pass ``gfp='only'`` (this makes it easier to +# read off the GFP data values, because the scale is aligned): l_aud.plot(gfp="only")