Back to the main page.

Bug 2344 - Non-Linear axis in ft_singleplotTFR

Status CLOSED INVALID
Reported 2013-10-29 11:54:00 +0100
Modified 2014-01-29 13:28:31 +0100
Product: FieldTrip
Component: plotting
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 trivial
Assigned to: Eelke Spaak
URL:
Tags:
Depends on:
Blocks:
See also:

- 2013-10-29 11:54:47 +0100

Hello, When I plot a multiplotTFR with a logarithmic scale on the Y axis, I've got the following warning : "Warning: (one of the) axis is/are not evenly spaced, but plots are made as if axis are linear" The warning doesn't appear when I use singleplotTFR however I think it should.


Eelke Spaak - 2013-10-29 11:59:40 +0100

Hi Aya, Is this warning a problem? In other words: do you expect the axes to be plotted with logarithmic spacing as well? I think it makes more sense to plot it linearly (so e.g. distance between 4 and 8 Hz the same as between 8 and 16 Hz, with a log base of 2). The warning is there just to alert users to this fact.


- 2013-10-29 14:05:55 +0100

(In reply to comment #1) I don't understand. If there is a logarithmic spacing, doesn't it mean that it's not linear ? I do logarithmic spacing as you said data.freq = log2(data.freq); Then I plot my TFR ft_singleplotTFR(cfg,data); set(gca, 'YTickLabel', power(2,get(gca, 'YTick'))); However I obtain strange results for the frequency axis, and I assumed it was due to the fact that I didn't use a linear spacing. By strange results I mean that when something is observed at 20Hz and the I resize the plot, the axis doesn't scale the same way as the TFR and so the something is then observed at another frequency (30Hz).


Eelke Spaak - 2013-10-29 14:09:54 +0100

(In reply to comment #2) The axis (in memory) can be logarithmically spaced, so freq.freq = [2 4 8 16...], and also the ticks on the Y-axis in the plot can be logarithmically spaced. FieldTrip does not space the ticks logarithmically, but can handle logarithmically spaced frequency axes (in memory). What happens when you do not do set(gca, 'YTickLabel', power(2,get(gca, 'YTick'))) after your call to ft_singleplotTFR? I suspect this explicit change of the tick labels is what is causing the problem.


- 2013-10-29 14:49:34 +0100

(In reply to comment #3) If I remove this line : "set(gca, 'YTickLabel', power(2,get(gca, 'YTick')))", instead of having the real value of the frequencies, I have the log2 of their values (e.g. instead of 32Hz, I have 5).


Robert Oostenveld - 2013-10-30 13:37:55 +0100

Could you try to also explicitly set YTick, so: set(gca, 'ytick', data.freq) ? Or whatever location you want the ticks to appear at? This would prevent the default Matlab behaviour of redetermining the tick locations upon resize. In general, you should always also set ytick/xtick if you are setting yticklabel/xticklabel. - Eelke (logged in as Robert)


- 2013-10-30 15:23:00 +0100

(In reply to comment #5) I just tried it, it works perfectly ! thanks ! I think I understand where was the problem, when I re-sized the plot, some ticks disappeared but matlab continued to display the smaller value. For example, if I had 8Hz 16Hz and 32Hz, and then I reduce the plot, matlab would remove the intermediate tick thus keeping 8Hz and 32Hz but with the smaller labels (8Hz and 16Hz). So if I understand the warning in my first message : "Warning: (one of the) axis is/are not evenly spaced, but plots are made as if axis are linear" It applies only to ft_multiplotTFR and the problem I had with singleplot had nothing to with it.


Eelke Spaak - 2013-10-30 15:24:35 +0100

(In reply to comment #6) Great, good to hear :) Will close this now.


Eelke Spaak - 2014-01-29 13:28:31 +0100

changing lots of bugs from resolved to closed.