[FieldTrip] default behaviour of singleplot changed?

Tom Marshall tom.marshall at psy.ox.ac.uk
Wed Nov 25 10:15:30 CET 2020


I think that it should work if you add cfg.figure = ‘gcf’ to the cfg to ft_singleplotTFR.

Confirmed. With this extra line in the cfg I get my subplots back.

Cheers JM!

Best,
Tom
________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Schoffelen, J.M. (Jan Mathijs) <jan.schoffelen at donders.ru.nl>
Sent: Wednesday, November 25, 2020 8:06 AM
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] default behaviour of singleplot changed?

Dear Tom,

I can confirm your problem. The issue you report results from an overhaul (intended to improve overall code consistency) of the plotting functions, intending to make the creation of new figures/overwriting of open figures etc. better behaved. Long story short, all plotting functions now have a call to open_figure (which is in fieldtrip/private) that does the low-level figure handling. I suspect that the default behavior is to create a clean figure each time the high-level plotting function is called (or to clear the current figure axes), which is at odds with what you want to achieve. I think that it should work if you add cfg.figure = ‘gcf’ to the cfg to ft_singleplotTFR.
Sorry for the inconvenience and keep up the good work.

Best wishes,
JM



On 24 Nov 2020, at 17:15, Tom Marshall <tom.marshall at psy.ox.ac.uk<mailto:tom.marshall at psy.ox.ac.uk>> wrote:

Hi fieldtrippers,

Has the default behaviour of the ft_singleplotXXX functions changed recently? Because I'm used to grouping several of them together using 'subplot' something like this...

% plot the TFR of the first five channels
figure
for i = 1:5
    cfg.channel = i;
    subplot(1, 5, i)
    ft_singleplotTFR(cfg, data)
end

Previously, executing this would give me five nicely arranged subplots within a single figure. However, using the bleeding-edge fieldtrip version, this code now creates five separate figures, each with a blank subplot, and the last TFR in its own sixth figure.

So it seems like 'subplot' is being executed (because matlab is drawing the subplot in a figure), but ft_singleplotTFR isn't drawing into the subplot, but rather creating a new figure.

checked:

which singleplotTFR
/home/common/matlab/fieldtrip/ft_singleplotTFR.m  (working on donders cluster - seems correct)

which subplot
/opt/matlab/R2020b/toolbox/matlab/graph2d/subplot.m (seems correct)

replacing ft_singleplotTFR(cfg, data) in the above code with a built-in plot function - e.g.,imagesc(rand(10)) - gives the expected row of subplots, so it seems like some (new?) behaviour of ft_singleplotTFR is causing matlab to treat it differently to its own plots.

help ft_singleplotTFR: Nothing here about subplots or handles.

Can somebody advise? Something simple I'm missing?

Best,
Tom
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201125/7027ca1e/attachment.htm>


More information about the fieldtrip mailing list