12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- %% Fig. 1J-K
- clear
- close all
- % ========================================
- %% Plot Heatmap - Go-Aligned
- % ========================================
- %prepare variables
- load('Fig1jk.mat');
- TimeWinFrame = [-15:1:120];% -0.5 s to 4.0 s
- fs = 30;
- StimWinFrame = [16 76];
- % 1st column: Initial - Naive
- % 2nd column: Initial - Expert
- % 3rd column: Reversal - Naive
- % 4th column: Reversal - Expert
- fig1 = figure('Name', 'Heatmap_GoAlighned_AllMice');
- fig1.Position = [900 250 1020 677];
- for iPhase = 1:4 %Task phase.
- %iPhase = 1: Initial Naive
- %iPhase = 2: Initial Expert
- %iPhase = 3: Reversal Naive
- %iPhase = 4: Reversal Expert
-
- for iRow = 1:2 %1 = Go, 2 = Nogo
- ConcatCaTrace = [];
- ConcatCaTrace_Sort = [];
-
- switch iRow
- case 1 %Go trial ----------------------------------------------
- ConcatCaTrace = GoCalcium{iPhase};
-
- %Sort cells in accordance with the activity (High-->Low)
- %Nogo trial data is sorted based on the Go trial data
- Row4Sort = mean(ConcatCaTrace(:,StimWinFrame(1):StimWinFrame(2)),2);
- [SortResp, SortID] = sortrows(Row4Sort, 'ascend');
- ConcatCaTrace_Sort = ConcatCaTrace(SortID, :);
- disp('Go')
- case 2 %Nogo trial---------------------------------------------
- ConcatCaTrace = NogoCalcium{iPhase};
- ConcatCaTrace_Sort = ConcatCaTrace(SortID,:);
- disp('Nogo')
- end%switch-iRow
-
- %Plot heatmap------------------------------------------------------
- subplot(2, 4, iPhase+(4*(iRow-1)));
- imagesc('XData', TimeWinFrame/fs, 'YData', [1 size(ConcatCaTrace_Sort, 1)], 'CData', ConcatCaTrace_Sort)%plot heatmap
- box off
- colorbar('box','off')
- caxis([-2.0 2.0])
- colormap(bluewhitered)
- hold on
-
- %Adjust y axis-----------------------------------------------------
- ylim([1 size(ConcatCaTrace_Sort, 1)]);
- yticks([1 size(ConcatCaTrace_Sort, 1)]);
-
- %Adjust x axis-----------------------------------------------------
- xlim([-0.5 4.0])
- xticks([0 2 4]);
-
- %Add title---------------------------------------------------------
- if iRow == 1
- switch iPhase
- case 1 %SensoryMap_Before
- title('BHV-Naive')
- ylabel('Go', 'FontSize', 10,'FontWeight','bold')
-
- case 2 %BHV-Initial
- title('BHV-Exp')
-
- case 3 %BHV-Naive
- title('REV-Naive')
-
- case 4 %BHV-Expert
- title('REV-Exp')
-
- end%switch-iPhase
- elseif ((iRow == 2)&& (iPhase == 1))
- ylabel('Nogo', 'FontSize', 10, 'FontWeight','bold')
- end%if iPhase
- xlabel('Time from Stim')
- end %for - iRow
- end%for - iPhase
- disp('Plot heatmap-Go aligned finished')
|