You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the epoch_colors parameter in MNE's epochs.plot() function, the custom colors display correctly on the initial view but become desynchronized when scrolling, resizing, or interacting with the plot. Instead of showing properly colored EEG traces, the plot shows vertical lines or color boxes overlaid on the data.
Affected Versions
MNE-Python: All versions with epoch_colors support
mne-qt-browser: All versions (default backend)
Backends affected: Both Qt (mne-qt-browser) and Matplotlib
Steps to reproduce
importmneimportnumpyasnp# Create sample epochsinfo=mne.create_info(ch_names=['Fz', 'Cz', 'Pz', 'Oz'], sfreq=256., ch_types='eeg')
n_epochs=50n_channels=4n_times=256data=np.random.randn(n_epochs, n_channels, n_times) *1e-6epochs=mne.EpochsArray(data, info)
# Create custom epoch_colors with distinct patterns# This makes it easy to see if colors are misalignedepoch_colors= []
foriinrange(n_epochs):
ifi%5==0:
colors= ['red', 'blue', 'red', 'red'] # Every 5th epoch is redelifi%3==0:
colors= ['blue', 'blue', 'red', 'blue'] # Every 3rd epoch is blueelifi%2==0:
colors= ['green', 'black', 'green', 'green'] # Even epochs are greenelse:
colors= ['black', 'black', 'green', 'black'] # Odd epochs are blackepoch_colors.append(colors)
# Plot with custom epoch_colorsfig=epochs.plot(epoch_colors=epoch_colors, n_epochs=10, block=True)
# STEPS TO REPRODUCE:# 1. Initial view shows epochs ✓ CORRECT# 2. Press Page Down or scroll right# 3. View now shows other epochs# 4. BUG: Colors show as vertical lines or are at wrong positions ✗ BROKEN
Expected results
Custom colors assigned to specific epochs via the epoch_colors parameter should:
Display correctly on initial render
Remain synchronized with their assigned epochs when scrolling
Maintain correct colors when resizing the window
Show colored EEG traces (not vertical lines or boxes)
Actual results
Initial view: Colors display correctly
After scrolling: Colors become desynchronized, showing:
Vertical lines instead of colored traces
Color boxes/rectangles overlaying the EEG data
Colors appearing at wrong epoch positions
Random color patterns unrelated to the assigned colors
Description of the problem
When using the
epoch_colorsparameter in MNE'sepochs.plot()function, the custom colors display correctly on the initial view but become desynchronized when scrolling, resizing, or interacting with the plot. Instead of showing properly colored EEG traces, the plot shows vertical lines or color boxes overlaid on the data.Affected Versions
Steps to reproduce
Expected results
Custom colors assigned to specific epochs via the
epoch_colorsparameter should:Actual results
Additional information
Screen.Recording.2026-04-24.at.16.10.27.mov