Skip to content

Channel data scroll only displays event durations if either the event onset or end of event duration are on screen. #941

@DMRoberts

Description

@DMRoberts

Description

If events have durations, the option to plot the durations is available in the Plot > Channel Data (scroll) window, by selecting "Display" > "Plot event duration". This shades the background of the plot window for the duration of the event. However it appears that event duration is only shaded if either the event onset, or the end of the duration, are currently visible in the plot window. The behavior is the same regardless of whether FORCE_EEGPLOT_LEGACY within eegplot.m is true or false.


#### Steps to Reproduce
  1. Load a dataset that has events with associated durations. For example, here is some synthetic data with a single event at 20 seconds that lasts 10 seconds (so the region between 20 and 30 seconds should be shaded):
% generate some test data
EEG = eeg_emptyset();
EEG.nbchan = 2;        
EEG.trials = 1;
EEG.srate = 500;
EEG.pnts = EEG.srate * 120;    
EEG.xmin = 0;          
EEG.data = randn(EEG.nbchan, EEG.pnts);
EEG.xmax = EEG.xmin + (EEG.pnts-1)/EEG.srate;
for i = 1:EEG.nbchan
    EEG.chanlocs(i).labels = sprintf('Ch%d', i);
end

EEG = eeg_checkset(EEG);

EEG.event(1).type = 'test_event';
EEG.event(1).latency = EEG.srate * 20; % event at 20 seconds    
EEG.event(1).duration = EEG.srate * 10; % 10 seconds in length
EEG = eeg_checkset(EEG, 'eventconsistency');

eeglab redraw;

  1. Open the channel scroll, and ensure 'Show Event Duration' is enabled (under plot Display menu).
  2. Scroll to the location of the event onset (here, 20 seconds into the recording). Observe the duration is correctly shaded:
Image
  1. Scroll the data farther, to where the event onset is now off screen. Observe that while the event duration hasn't yet elapsed (it is set to 10 seconds), the plot is no longer shaded:
Image
  1. Scroll the data even farther, until the end of the event duration is now on screen (in this case, 30 seconds into the recording). The plot is now correctly shaded again:
Image
#### Expected behavior: I would expect that the entire duration of a given event is displayed, regardless of whether the event onset max duration are currently being displayed.
#### Actual behavior: Event durations disappear while the event onset or end of the duration period are offscreen.
#### Versions
OS version MacOS 15.7.5, Apple Silicon]
Matlab version R2026a
EEGLAB version 2026.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions