function plotROISpatioTemporalTuning(spatialFreq, temporalFreq, tuningMap) %% Plot interpolated and original map. Assumes F1 or mean. % tuning map has columns of constant temporal frequencies. Transpose it to % have columns of constant spatial frequency, i.e., x=spatial freqs, % y=temporal freqs. tuningMap = tuningMap'; %% Interpolate tuning map. [xGrid, yGrid] = meshgrid(spatialFreq, temporalFreq); % Finer grid. spatialFreqQs = 2 .^ linspace(log2(spatialFreq(1)), log2(spatialFreq(end)), 100);%(-1: -0.5: -5); temporalFreqQs = 2 .^ linspace(log2(temporalFreq(1)), log2(temporalFreq(end)), 100);%(-2: 0.5: 4); [xGridQ, yGridQ] = meshgrid(spatialFreqQs, temporalFreqQs); interpTuningMap = griddata(xGrid, yGrid, tuningMap, xGridQ, yGridQ, 'cubic'); cMap = parula; hFig = createPrintFig(15 * [1 1.2]); for iAx = 1: 4 hSubAx(iAx) = subplot(2, 2, iAx); hold(hSubAx(iAx), 'on'); end colormap(cMap); % Plot spatial and temporal tuning and its interpolation. hMapRaw = imagesc(hSubAx(1), log2(spatialFreq), log2(temporalFreq), (tuningMap)); hMapInterp = imagesc(hSubAx(2), log2(spatialFreqQs), log2(temporalFreqQs), (interpTuningMap)); % Plot spatial tuning by collapsing over temporal frequencies. plot(hSubAx(3), log2(spatialFreq), mean(tuningMap, 1)); plot(hSubAx(3), log2(spatialFreqQs), mean(interpTuningMap, 1)); % Plot temporal tuning by collapsing over spatial frequencies. plot(hSubAx(4), log2(temporalFreq), mean(tuningMap, 2)); plot(hSubAx(4), log2(temporalFreqQs), mean(interpTuningMap, 2)); set([hSubAx(1: 3).XLabel], 'String', '$\displaystyle\frac{1}{\lambda}$'); set([hSubAx(4).XLabel], 'String', '$\nu$'); set([hSubAx(1: 2).YLabel], 'String', '$\nu$'); set([hSubAx(3: 4).YLabel], 'String', '$A_1$'); set([hSubAx.XLabel], 'Interpreter', 'latex'); set([hSubAx.YLabel], 'Interpreter', 'latex'); hSubAx(iAx).XLabel.Interpreter = 'latex'; set([hSubAx(1: 2).YLabel], 'String', '$\nu$'); set([hSubAx(1: 2).YLabel], 'Interpreter', 'latex'); hSubAx(2).XLabel.String = '$\displaystyle\frac{1}{\lambda}$'; hSubAx(1).XLabel.Interpreter = 'latex'; hSubAx(1).YLabel.String = '$\nu$'; hSubAx(1).YLabel.Interpreter = 'latex'; linkaxes(hSubAx(1: 2), 'xy') set(hSubAx, 'YDir', 'normal'); axis(hSubAx, 'square'); axis(hSubAx, 'tight'); arrayfun(@prettifyAxes, hSubAx); arrayfun(@offsetAxes, hSubAx(3:4)); end