Skip to content

Commit e965594

Browse files
committed
fixed issue with individual topography plots
1 parent afe900a commit e965594

File tree

3 files changed

+22
-24
lines changed

3 files changed

+22
-24
lines changed

ResultViewer/Dependencies/ept_ClusRes.mexa64

100644100755
4.12 KB
Binary file not shown.

ResultViewer/Tools/ept_FactorTopoplots.m

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function [] = ept_FactorTopoplots(Data, e_loc, Results, Factor, Sample)
1+
function ept_FactorTopoplots(Data, e_loc, Results, Factor, Sample)
22
%% Levels and Statistics Topoplot Tight
33

44
% This file is part of the program ept_ResultViewer.
@@ -30,7 +30,8 @@
3030
b = cellfun(@mean, a, 'UniformOutput', false);
3131
Stats = Results.TFCE_Obs.B(:,Sample)';
3232
else
33-
error('Only main effects currently available: Factor = 1 or 2.')
33+
fprintf('Only main effects currently available: Factor = 1 or 2.');
34+
return
3435
end
3536
else
3637
a = cellfun(@(x) x(:,:,Sample), Data, 'UniformOutput', false);

ResultViewer/Tools/ept_IndividualTopoplots.m

+19-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function H = ept_IndividualTopoplots(Data, e_loc, Results, Factor, Sample)
2-
%% Ept function to plot each individuals topography for a given sample...
2+
% Ept function to plot each individuals topography for a given sample...
33

44
% Input
55
% If channel*frequency*time data then the Sample variable should be
@@ -12,7 +12,7 @@
1212
Stats = Results.TFCE_Obs.A(:,Sample)';
1313
elseif Factor == 2
1414
Data = Data';
15-
iData = cellfun(@(x) x(:,:,Sample), Data, 'UniformOutput', false);
15+
iData = cellfun(@(x) x(:,:,Sample), Data, 'UniformOutput', false);
1616
b = cellfun(@mean, iData, 'UniformOutput', false);
1717
Stats = Results.TFCE_Obs.B(:,Sample)';
1818
else
@@ -24,7 +24,7 @@
2424
Stats = Results.TFCE_Obs(:,Sample)';
2525
end
2626

27-
%% Calculate the average ERP over multiple conditions (just cell2mat for single condition TTest)
27+
% Calculate the average ERP over multiple conditions (just cell2mat for single condition TTest)
2828
gData = zeros(size(b,1), numel(b{1}));
2929
% will have to make multiple condition means for iData too...
3030
for i = 1:size(b,2);
@@ -35,16 +35,17 @@
3535
gData = gData/size(b,2);
3636

3737

38-
%% Calculate plot specific variables
38+
% Calculate plot specific variables
3939
% Find max number of participants in each group and add 3 (TFCE Stats will be twice as large...
4040

41-
numPlots = max(cell2mat(cellfun(@(x) size(x,1), Data, 'UniformOutput', false)))+3;
41+
group_sizes = cellfun(@(x) size(x,1), Data);
42+
numPlots = max(group_sizes(:))+3;
4243

4344
axesPos = (0:1:numPlots)/numPlots; % Determines the starting x-axis point for each plot (last element redundant)
4445
axesWidth = 1/numPlots;
4546
mapLimits = [min(gData(:)), max(gData(:))]; % Calculates the total ERP amplitude range over all groups to adjust the colormaps later
4647

47-
%% Prepare the figure
48+
% Prepare the figure
4849
H.Figure = figure;
4950
set(H.Figure,...
5051
'Name', ['S:' num2str(Sample) ' Factor Topoplots'] ,...
@@ -60,6 +61,7 @@
6061
for i = 1:numPlots-2 % loop for plots (individuals + group)
6162

6263
H.Axes(i,j) = axes(...
64+
'parent', H.Figure,...
6365
'Position', [axesPos(i) (j-1)/size(iData,1) axesWidth 1/size(iData,1)] ,...
6466
'xtick', [] ,...
6567
'ytick', [] );
@@ -72,28 +74,23 @@
7274
H.TFCEAxes = axes('Position', [axesPos(end-2), 0, axesWidth*2, 1]);
7375

7476
% Adjusts the maps color scheme so topoplot colours are equal among level topoplots
75-
set(H.Axes,...
76-
'CLim', mapLimits );
77-
78-
%% Plot the actual topoplots of each individual
77+
set(H.Axes,'CLim', mapLimits);
7978

79+
% Plot the actual topoplots of each individual
8080
for j = 1:size(iData,1) % loop for rows (levels)
8181
for i = 1:size(iData{j},1) % loop for plots (individuals + group)
82-
83-
set(H.Figure,'CurrentAxes',H.Axes(i,j))
84-
ept_Topoplot(iData{j}(i,:), e_loc);
85-
82+
% draw each topoplot
83+
ept_Topoplot(iData{j}(i,:), e_loc,...
84+
'Axes', H.Axes(i,j));
8685
end
8786
end
8887

89-
%% Plot group topoplots
88+
% Plot group topoplots
9089
for i = 1:size(gData,1)
91-
92-
set(H.Figure,'CurrentAxes',H.Axes(end,i))
93-
ept_Topoplot(gData(i,:), e_loc);
94-
90+
ept_Topoplot(gData(i,:), e_loc,...
91+
'Axes', H.Axes(end, i));
9592
end
9693

97-
%% Plot the larger TFCE topoplot
98-
set(H.Figure,'CurrentAxes',H.TFCEAxes)
99-
ept_Topoplot(Stats, e_loc);
94+
% Plot the larger TFCE topoplot
95+
ept_Topoplot(Stats, e_loc,...
96+
'Axes', H.TFCEAxes);

0 commit comments

Comments
 (0)