# [FieldTrip] Plotting confidence intervals in multiplotER

kousik sarathy sarathykousik at gmail.com
Wed Oct 5 15:55:26 CEST 2016

```Hi Arti,

The best I can suggest is a two step process. ft_timelockgrandaverage you
should see a keepindividual option. You can collate your subject x chan x
time as a single 3-D dataset. Then you can manually make your own fields of
mean and sem.

--
Regards,
Kousik Sarathy, S

On Wed, Oct 5, 2016 at 7:57 AM, Arti Abhishek <mailtome.2113 at gmail.com>
wrote:

> Dear Kousik,
>
> Thank you very much for your help. I am not sure how to change the
> "dat_sem" as you suggested. My grand averaged file has the fields as follows
>
> GrandAvg_Target1 =
>
>        avg: [132x601 double]
>        var: [132x601 double]
>        dof: [132x601 double]
>       time: [1x601 double]
>      label: {132x1 cell}
>     dimord: 'chan_time'
>        cfg: [1x1 struct]
>
> I am a beginner in MATLAB and any help would be greatly appreciated.
>
> Thanks,
> Arti
>
> On Thu, Sep 15, 2016 at 5:39 PM, kousik sarathy <sarathykousik at gmail.com>
> wrote:
>
>> Hey Arti,
>>
>> This is not such a trivial thing to solve. Here's a recipe I used. You
>> need to find and edit two scripts. If this spurns any more interest, I'll
>> initiate a 'bug' and try to send in a pull request. This is a dirty fix and
>> in all probability will be considered blasphemy.  ;)
>>
>> 1. Find in ft_multiplotER
>> <https://github.com/fieldtrip/fieldtrip/blob/master/ft_multiplotER.m#L704>
>> :
>> ft_plot_vector(xval, yval, 'width', width(m), 'height', height(m), 'hpos',
>> layX(m), 'vpos', layY(m), 'hlim', [xmin xmax], 'vlim', [ymin ymax], '
>> color', color, 'style', cfg.linestyle{i}, 'linewidth', cfg.linewidth, '
>> axis', cfg.axes, 'highlight', mask, 'highlightstyle', cfg.maskstyle, '
>> label', label, 'box', cfg.box, 'fontsize', cfg.fontsize);
>> This basically calls a plotting function which in turn does the plotting
>> for you. You need to send in the extra 'sem' or a 'ci' variable.
>> Change this to:
>> ft_plot_vector(xval, yval, 'ysem', ysem, 'width', width(m), 'height',
>> height(m), 'hpos', layX(m), 'vpos', layY(m), 'hlim', [xmin xmax], 'vlim',
>> [ymin ymax], 'color', color, 'style', cfg.linestyle{i}, 'linewidth',
>> cfg.linewidth, 'axis', cfg.axes, 'highlight', mask, 'highlightstyle',
>> cfg.maskstyle, 'label', label, 'box', cfg.box, 'fontsize', cfg.fontsize);
>>
>> 2. Find in ft_plot_vector
>> <https://github.com/fieldtrip/fieldtrip/blob/1b624e4e84cfd9e99e99cb391c91e961a03eea07/plotting/ft_plot_vector.m#L318>
>> :
>> You need to first get the sem parameter from your data and setup so FT
>> can see your sem or CI info. Follow the code here
>> <https://github.com/sarathykousik/sefSourceAnalysis/blob/master/multiplotER-bounded.m> .
>> Search for "data_sem" and fix those lines.
>> Then:
>> h = plot(hdat, vdat, style, 'LineWidth', linewidth, 'Color', color, '
>> markersize', markersize, 'markerfacecolor', markerfacecolor);
>> Change this to:
>> [h hp ]= boundedline(hdat, vdat, vdat_sem);
>>
>> Boundedline
>> <https://www.mathworks.com/matlabcentral/fileexchange/27485-boundedline-m>is
>> a submission in the MATLAB file exchange. You can use any other thing.
>>
>>
>> Good luck trying! :)
>>
>>
>> --
>> Regards,
>> Kousik Sarathy, S
>>
>>
>> On Thu, Sep 15, 2016 at 7:36 AM, Arti Abhishek <mailtome.2113 at gmail.com>
>> wrote:
>>
>>> Dear fieldtrip community,
>>>
>>> I was wondering whether there is a way to plot the confidence intervals
>>> in the ERP plot? I see that this question was asked multiple times in the
>>> discussion list before, but I could not find an answer to this.
>>>
>>> Thanks,
>>> Arti
>>>
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20161005/abbdf1fe/attachment-0002.html>
```