Back to the main page.

Bug 2320 - Interactivity and subplot

Reported 2013-10-14 13:13:00 +0200
Modified 2015-10-06 01:22:37 +0200
Product: FieldTrip
Component: plotting
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 trivial
Assigned to: Roemer van der Meij
Depends on:
See also:

- 2013-10-14 13:13:32 +0200

Hello, I do a subplot over several dataset like this : for i=1:nb_data subplot(subx,suby,i); ft_singleplotTFR(cfg, data{i}.freqlog); end I have set cfg.interactive = 'yes'; but when I use the interactivity (ie make a rectangle and clicking it), the data used for doing the topoplot is always the last data plotted and not the data I have selected.

- 2013-10-17 18:28:24 +0200

I'm actually familiar with this problem. If you use ft_singleplotTFR multiple times, each time with a different dataset. It seems that somehow the most recent (or in my case, if I remember correctly, the first) dataset chosen is kept in memory, and always plotted each time the function is called, unless a the clear command is used.

- 2013-10-21 09:41:55 +0200

(In reply to comment #1) In my case topoplot plot the last data of the figure. However the interactivity works fine when instead of doing subplots I plot each singleplot in a new figure. for i=1:nb_data figure; ft_singleplotTFR(cfg, data{i}.freqlog); end

Roemer van der Meij - 2013-10-23 10:52:45 +0200

Hi both, While writing this, I've become increasingly sure this should be possible to implement, and not too difficult. Right now, it won't work, as 'data' for the interactivity is attached to the figure window (matlab's way of making gui's), and this is always the last one, it overwrites the rest. However, it should be possible to attach the data with a unique identifier, so the correct one is used. To be a bit more certain that this could work, when you select e.g. time/freq points in the interactive bit, does it select the proper frequencies/timepoints (even though it used the incorrect data)?

- 2013-10-23 14:57:46 +0200

(In reply to comment #3) I've done some test and the results are weird. If I change the time of the first subplot (the one I want to see the topoplot) and that I select times that aren't on the last TFR plotted, it throws me an error. If I change the frequency of the first subplot (the one I want to see the topoplot) and that I select frequencies that aren't on the last TFR plotted, it still plots the topoplot of the last TFR plotted. It says : the call to "ft_singleplotTFR" took 0 seconds the call to "ft_singleplotTFR" took 0 seconds selected cfg.xlim = [0.222367 0.566460] selected cfg.ylim = [501.464642 566.334729] However, those frequencies doesn't exist. It's like it didn't care that I have changed the frequencies on the first subplot. I hope it'll help you.

Roemer van der Meij - 2013-10-24 16:38:35 +0200

Ah, thanks, that's what I was worried about. It selects based on the cursor position in the figure window, and not on the current axis. It could still be possible, but will require a more work. I'm gonna contemplate whether there is an handy solution.

- 2013-10-25 09:06:13 +0200

(In reply to comment #5) Great! thanks What you said seems true for the frequency axis but not for the time axis since it threw me an error when I selected times which didn't exist for the last subplot. That's why I considered it was 'weird'.

Roemer van der Meij - 2014-01-29 15:21:38 +0100

Sorry for my humongously late response, I was caught up in things. I've changed the interactive mode to work together with subplots. Everything should work properly now! Could one of you check whether it's working properly in your cases?

Roemer van der Meij - 2015-10-06 01:22:37 +0200

Closing old resolved bugs