Back to the main page.

Bug 2325 - ft_multiplotER and ft_singleplotER do not plot the ERP/F waveform

Reported 2013-10-17 16:09:00 +0200
Modified 2018-03-10 21:34:27 +0100
Product: FieldTrip
Component: plotting
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to:
Depends on:
See also:

- 2013-10-17 16:09:18 +0200

These functions produce the figure and the axes correctly however the actual ERP/ERF waveform is missing from the plot. This was first reported by a user, and then I (nielam) tested it with the data on the event-related tutorial, and also found the same thing. I would like to try solving this, but am not too sure where to start, would be great if anyone has any tips. thanks!

Jörn M. Horschig - 2013-10-17 16:36:04 +0200

Created attachment 532 my data that works for me :) Hi Nietzsche, try to work your way updwards - put a breakpoint to the line of the warning and use the commands dbup and dbdown to go through your stack (use dbstack to check the current stack). Try to identify why the warning occurs (what if-statement is true for the warning to be thrown, does that make sense?), then put another breakpoint to some line where the variables checked in the if-statement are assigned and check why they get the value they get. This is a recursive procedure, so you put breakpoints at lines where something crucial happens, check variables and try to identify earlier lines where something might have gone wrong, set another breakpoint, etc. success eermee ;) btw, the function works fine for me with my data. I attached my data so that you can compare what goes wrong with the tutorial data and works with my data. I use: cfg = []; cfg.layout = 'easycapM15'; cfg.preproc.detrend = 'yes'; figure; ft_multiplotER(cfg, gatimelock);

- 2013-10-17 17:11:19 +0200

Oh, oh! So it seems that the problem was setting the axes too tightly. When I specified cfg.ylim = ''; then the data plotted just fine. So I should probably change something about the axis limits, weird how this didn't happen before.. I'll keep digging!

- 2013-10-17 18:26:37 +0200

currently the ylim of the data is: [-2.34e13 2.85e13], so the ylim as indicated in the tutorial [-3e13 3e13] should work because the data is within the defined limits. Need to figure out why when defining a ylim (any ylim, as I tried different ones) leads to no waveform being plotted.

Robert Oostenveld - 2013-10-20 11:38:55 +0200

I can imagine a few reasons that data might unexpectedly not be displayed. Should we consider printing a warning on screen? Like "warning: your selection of channels may result in no data being displayed?" "warning: your selection of xlim may result in no data being displayed?" "warning: your selection of ylim may result in no data being displayed?" "warning: your selection of zlim may result in no data being displayed?"

Roemer van der Meij - 2013-10-23 10:57:09 +0200

As extra tip, commands that I find very useful when debugging (which for some reason I only learned of after 4 years): dbup - when in debugmode, move your workspace up one function call dbdown - when in debugmode, move your workspace down one function call dbstop if error - enter debugmode when an error occurs dbclear if error - clear the above dbstop if warning - enter debugmode when a warning occurs dbclear if warning - clear the above A warning like Robert's sounds like a good idea

- 2013-10-23 10:58:35 +0200

Thanks guys! I actually looked into this again, and there was just no problem... I got the user's data, called ft_timelockanalysis and then ft_multiplotER and all the waveforms were there. I'm just waiting to see if the user will get back to me to say if it worked for her or not.

- 2013-10-23 10:59:39 +0200

oh but a separate matter is still why when indicating the ylim the data doesn't work. I'll look into it again

- 2014-10-31 00:29:12 +0100

I looked at the previous comments again, went through the code with debug mode to check my suspicion. My suspicion is correct: younger me had issues with magnitude and scales. [-3e13 3e13] should have been [-3e-13 3e-13] closing bug.