Skip to content

Plot the results

David López-García edited this page Oct 13, 2021 · 6 revisions

Result representation pipeline

In addition to the graphic user interface, MVPAlab implements different high-level functions to generate highly-customizable graphical representation of the results. Once the decoding analysis is completed and the results files are saved, the graphical representation pipeline runs as follows:

% 1. Initialize and configure plots:
graph = mvpalab_plotinit();

% 2. Load results and and statistics if needed:
load results/time_resolved/acc/result.mat
load results/time_resolved/acc/stats.mat

% 3. Some extra graphic configuration:

% 3.1 Axis limits:
graph.xlim = [-200 1500];
graph.ylim = [.3 .95];

% 3.2 Axes labels and titles:
graph.xlabel = 'Time (ms)';
graph.ylabel = 'Classifier performance';
graph.title = 'Demo plot (no statistical significance)';

% 3.3 Smooth results:
graph.smoothdata = 5; % (1 => no smoothing)

% 3.4 Plot significant clusters (above and below chance):
graph.stats.above = true;
graph.stats.below = true;
graph.sigh = .4;

% 4. Plot results:
figure;
hold on
mvpalab_plotdecoding(graph,cfg,result,stats);

First, the function mvpalab_plotinit() generates and returns a default configuration structure (graph) containing all the required configuration parameter:

graph = mvpalab_plotinit();

Then, the specific result file (and stats if needed) to be plotted should be loaded:

load results/time_resolved/acc/result.mat
load results/time_resolved/acc/stats.mat

Finally, the high-level plotting function returns the graphical representation of the selected result file:

mvpalab_plotdecoding(graph,cfg,result,stats);

The variable stats is optional and contains, among others, the statistically significant clusters. If this variable is not omitted, significant results will be highlighted in the resulting figure.

High-level plotting functions:

Several plotting functions are available for different types of analysis:

mvpalab_plotdecoding(graph,cfg,result,stats);
mvpalab_plottempogen(graph,cfg,result,stats);
mvpalab_plotfreqcont(graph,cfg,result,stats);
mvpalab_plotfeatcont(graph,cfg,wvector,result);
  • The mvpalab_plotdecoding() function generates time-resolved performance plots.
  • The mvpalab_plottempogen() function is used for the graphical representation of temporal generalization matrices.
  • The mvpalab_plotslidfilt() function generates the graphical representation for the frequency contribution analysis.
  • The mvpalab_plotfeatcont() can generate topological representations and temporal animations of features contribution to the decoding performance.

Extra configuration parameters:

To get the best of the MVPAlab Toolbox plotting capabilities the use of the graphic user interface is highly recommended. This is a fast, flexible and very intuitive manner to design high-quality plots. Even so, the same results can be obtained by hand coding several configuration parameters included in the graph configuration structure.

A complete selection of the most useful configuration parameters and a short explanation is listed below:

% Time-resolved decoding analysis:
% --------------------------------------------------
graph.plotmean   = true; % Plot group average
graph.smoothdata = 5;    % Window size for data smoothing
graph.stdsem     = true; % Plot Standard Deviation or Standard Error of the Mean
graph.linestyle  = '-';  % Line style
graph.linewidth  = 1;    % Line width
% 2D decoding analysis (TEMPOGEN or FREQCONT):
% --------------------------------------------------
graph.clusterLineColor = [0 0 0]; % Cluster line color in RGB code.
graph.clusterLineWidth = 1;       % Cluster line width.
graph.caxis = [.4 .9];            % Color range.
% Feature contribution analysis:
% --------------------------------------------------
graph.weights.type  = 'raw'; % Raw or corrected features
graph.weights.anim  = true;  % Animated/static plot
graph.weights.speed = 0.1;   % Animation speed
graph.weights.start = 400;   % Start time (ms) 
graph.weights.end   = 450;   % End time (ms)
graph.weights.sub   = 1;     % Individual subject
% Highlight significant result:
% --------------------------------------------------
graph.sigmode.points = true; % Points/shade plot
graph.stats.above    = true; % Above chance clusters
graph.stats.below    = true; % Below chance clusters
graph.sigh           = 0.4;  % Significant points position 
% Font, titles, labels and axes limits:
% --------------------------------------------------
graph.fontsize = 14;
graph.title    = 'MVPAlab - default figure';
graph.ylabel   = 'Classifier performance';
graph.xlabel   = 'Time (ms)';
graph.xlim     = [-200 1500];
graph.ylim     = [0 1];
% Individual subject plots:
% --------------------------------------------------
graph.subject = 3; % Subject idx (for individual plots)
Clone this wiki locally