plotROISpatioTemporalTuning.m 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. function plotROISpatioTemporalTuning(spatialFreq, temporalFreq, tuningMap)
  2. %% Plot interpolated and original map. Assumes F1 or mean.
  3. % tuning map has columns of constant temporal frequencies. Transpose it to
  4. % have columns of constant spatial frequency, i.e., x=spatial freqs,
  5. % y=temporal freqs.
  6. tuningMap = tuningMap';
  7. %% Interpolate tuning map.
  8. [xGrid, yGrid] = meshgrid(spatialFreq, temporalFreq);
  9. % Finer grid.
  10. spatialFreqQs = 2 .^ linspace(log2(spatialFreq(1)), log2(spatialFreq(end)), 100);%(-1: -0.5: -5);
  11. temporalFreqQs = 2 .^ linspace(log2(temporalFreq(1)), log2(temporalFreq(end)), 100);%(-2: 0.5: 4);
  12. [xGridQ, yGridQ] = meshgrid(spatialFreqQs, temporalFreqQs);
  13. interpTuningMap = griddata(xGrid, yGrid, tuningMap, xGridQ, yGridQ, 'cubic');
  14. cMap = parula;
  15. hFig = createPrintFig(15 * [1 1.2]);
  16. for iAx = 1: 4
  17. hSubAx(iAx) = subplot(2, 2, iAx);
  18. hold(hSubAx(iAx), 'on');
  19. end
  20. colormap(cMap);
  21. % Plot spatial and temporal tuning and its interpolation.
  22. hMapRaw = imagesc(hSubAx(1), log2(spatialFreq), log2(temporalFreq), (tuningMap));
  23. hMapInterp = imagesc(hSubAx(2), log2(spatialFreqQs), log2(temporalFreqQs), (interpTuningMap));
  24. % Plot spatial tuning by collapsing over temporal frequencies.
  25. plot(hSubAx(3), log2(spatialFreq), mean(tuningMap, 1));
  26. plot(hSubAx(3), log2(spatialFreqQs), mean(interpTuningMap, 1));
  27. % Plot temporal tuning by collapsing over spatial frequencies.
  28. plot(hSubAx(4), log2(temporalFreq), mean(tuningMap, 2));
  29. plot(hSubAx(4), log2(temporalFreqQs), mean(interpTuningMap, 2));
  30. set([hSubAx(1: 3).XLabel], 'String', '$\displaystyle\frac{1}{\lambda}$');
  31. set([hSubAx(4).XLabel], 'String', '$\nu$');
  32. set([hSubAx(1: 2).YLabel], 'String', '$\nu$');
  33. set([hSubAx(3: 4).YLabel], 'String', '$A_1$');
  34. set([hSubAx.XLabel], 'Interpreter', 'latex');
  35. set([hSubAx.YLabel], 'Interpreter', 'latex');
  36. hSubAx(iAx).XLabel.Interpreter = 'latex';
  37. set([hSubAx(1: 2).YLabel], 'String', '$\nu$');
  38. set([hSubAx(1: 2).YLabel], 'Interpreter', 'latex');
  39. hSubAx(2).XLabel.String = '$\displaystyle\frac{1}{\lambda}$';
  40. hSubAx(1).XLabel.Interpreter = 'latex';
  41. hSubAx(1).YLabel.String = '$\nu$';
  42. hSubAx(1).YLabel.Interpreter = 'latex';
  43. linkaxes(hSubAx(1: 2), 'xy')
  44. set(hSubAx, 'YDir', 'normal');
  45. axis(hSubAx, 'square');
  46. axis(hSubAx, 'tight');
  47. arrayfun(@prettifyAxes, hSubAx); arrayfun(@offsetAxes, hSubAx(3:4));
  48. end