[Eeglablist] Plotting standard error shades on ERP

Cedric Cannard ccannard at protonmail.com
Mon Jul 19 02:51:08 PDT 2021


Hi Paul,

Below is an example of one subject's epoched data. Define your channel_number of interest and for grand average. FOr you, the 3rd dimension is subjects instead of epochs.

data1 = squeeze(EEG.data(channel_number,:,:));
nEpochs = size(data1,2);
data1_mean = mean(data1,2)';
data1_se = std(data1 ./ sqrt(nEpochs),[],2)';
color1 = [0, 0.4470, 0.7410];
xAxis = 1:size(data1,1);        %ADJUST WITH YOUR LAGS

plot(xAxis, data1_mean,'LineWidth',2,'Color',color1); hold on
fillhandle = fill([xAxis fliplr(xAxis)], [data1_mean-data1_se fliplr(data1_mean+data1_se)], color1);
set(fillhandle,'EdgeColor', color1,'FaceAlpha',0.2,'EdgeAlpha',0.8);
set(gca,'FontSize',12,'layer','top');
grid on; axis tight; box on;
ylabel('ERP amplitude','FontSize',12);
xlabel('Time','FontSize',12);
hPlots = flip(findall(gcf,'Type','Line'));
legend(hPlots, 'data1Name (SE)');

And simply duplicate the lines containing data1 with data2 to superimpose another condition/group (i.e., data2).

Cedric


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Sunday, July 18th, 2021 at 4:25 AM, Beach, Paul via eeglablist <eeglablist at sccn.ucsd.edu> wrote:

> Hi EEGLAB’ers
>
> I’ve seen this posted a few times. Seems like it’s relatively standard now to include standard error “shades” in publications these days of ERP data. I’d like to do this on my grand averaged STUDY data but am having a few hard time figuring out how to do so in EEGLAB. I sawCedric
>
> had recommended a function he made using Matlab’s “fill” function, but seeing as this was seen in archived eeglablist data I cannot get the actual function.
>
> Does anyone have tips/tricks for doing this in EEGLAB or other (preferably simple) methods?
>
> Thanks!
>
> Paul
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Paul Beach DO, PhD
>
> PGY6, Movement Disorder Fellow
>
> Department of Neurology
>
> Emory University School of Medicine
>
> This e-mail message (including any attachments) is for the sole use of
>
> the intended recipient(s) and may contain confidential and privileged
>
> information. If the reader of this message is not the intended
>
> recipient, you are hereby notified that any dissemination, distribution
>
> or copying of this message (including any attachments) is strictly
>
> prohibited.
>
> If you have received this message in error, please contact
>
> the sender by reply e-mail message and destroy all copies of the
>
> original message (including attachments).
>
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
>
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
>
> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu



More information about the eeglablist mailing list