12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- %% Fig. 2AB - Heatmap
- close all
- clear all
- % ========================================
- %% Plot Heatmap - Go-kmeans
- % ========================================
- %prepare variables
- load('Fig2AB_Heatmap.mat');
- TimeWinFrame = [-15:1:120];% ca -0.5 s to 4.0 s
- fs = 30;
- for iLearning = 1:2 %Initial and Reversal
-
- ConcatCaTrace = [];
- trans = [];
- switch iLearning
- case 1 %Initial learning
- fig1 = figure('Name', 'Initial k-mean - Go cluster - Heatmap');
- ConcatCaTrace = Calcium_Initial;%Calcium data from initial learning
- trans = trans_Initial;
- case 2 %Reversal learning
- fig2 = figure('Name', 'Reversal k-mean - Go cluster - Heatmap');
- ConcatCaTrace = Calcium_Reversal;%Calcium data from initial learning
- trans = trans_Reversal;
- end
-
- for iColumn = 1:2 %1 = Naive, 2 = Expert
- switch iColumn
- case 1 %Naive -------------------------------------------------
- subplot(1,2,1);
- title('naive')
- case 2 %Expert ------------------------------------------------
- subplot(1,2,2);
- title('expert')
- end%switch-iRow
-
- %Plot heatmap------------------------------------------------------
- imagesc('XData', TimeWinFrame/fs, 'YData', [1 size(ConcatCaTrace, 1)], 'CData', ConcatCaTrace(:, :, iColumn))%plot heatmap
- box off
-
- %Line separating clusters
- lims = axis;
- hold all;
- line(repmat(lims(1:2)', 1,length(trans)),repmat(trans',2,1), 'color','k','linewidth',1)
-
- %Add colorbar
- colorbar;
- colorbar('box','off');
- caxis([-1.5 1.5]);
- colormap(bluewhitered);
- hold on
-
- %Adjust y axis-----------------------------------------------------
- ylim([1 size(ConcatCaTrace, 1)]);
- yticks([1 size(ConcatCaTrace, 1)]);
- ylabel('Celll ID')
- %Adjust x axis-----------------------------------------------------
- xticks([0 2 4]);
- xlabel('Time from Stimulus')
- end %for - iColumn
- end%for - iLearning
|