Skip to content

Commit

Permalink
Option corMatrix added to avasmsplot
Browse files Browse the repository at this point in the history
%  corMatrix  : correlation matrix among the input solutions. Array of size
%               maxBestSol-by-maxBestSol or [] (default). If this optional
%               argument is supplied it is possible to have in output the
%               heatmap among the different solutions. The correlation
%               matrix is returned as second output of function avasmsplot.
%               If corMatrix is an empty value (default) just the augmented
%               star plot is shown on the screen.
  • Loading branch information
MarcoRianiUNIPR committed Nov 20, 2023
1 parent 6b2af67 commit d2826f8
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions graphics/avasmsplot.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@
% Data Types - logical
%
%
% corMatrix : correlation matrix among the input solutions. Array of size
% maxBestSol-by-maxBestSol or [] (default). If this optional
% argument is supplied it is possible to have in output the
% heatmap among the different solutions. The correlation
% matrix is returned as second output of function avasmsplot.
% If corMatrix is an empty value (default) just the augmented
% star plot is shown on the screen.
% Example - 'corMatrix',eye(p)
% Data Types - double
%
%
% tag : Personalized plot tag. String. String which identifies
% the handle of the plot which
% is about to be created. The default is to use tag
Expand Down Expand Up @@ -311,8 +322,10 @@
tag='pl_augstarplot';
showBars=false;
addPolygons=true;
corMatrix = [];
options=struct('maxBestSol',maxBestSol,'tag',tag,...
'databrush',databrush,'showBars',showBars,'addPolygons',addPolygons);
'databrush',databrush,'showBars',showBars,'addPolygons',addPolygons, ...
'corMatrix',corMatrix);

if nargin > 1
[varargin{:}] = convertStringsToChars(varargin{:});
Expand All @@ -334,9 +347,10 @@
databrush=options.databrush;
showBars=options.showBars;
addPolygons=options.addPolygons;
corMatrix=options.corMatrix;
end

% the maximum number of solutions to show is equalù
% the maximum number of solutions to show is equal
% to the rows of BestSol
if isempty(maxBestSol)
maxSol=size(BestSol,1);
Expand Down Expand Up @@ -366,6 +380,19 @@
set(gcf,'Tag',tag,'Name', 'Augmented star plot', 'NumberTitle', 'off')


if ~isempty(corMatrix)
% Create the heatmap of the correlation matrix of the best solutions
% which have been found (just if maxSol>1)
if maxSol>1
hold off
figure
xval="Sol"+(1:maxSol)';
heatmap(xval,xval,corMatrix(1:maxSol,1:maxSol),'MissingDataColor','w')
title('Heatmap of the correlation matrix among the best solutions')
set(gcf,'Tag','pl_heatmap')
end
end

%% Brush mode (call to function selectdataFS)
if ~isempty(databrush) || isstruct(databrush)
if isstruct(databrush)
Expand Down

0 comments on commit d2826f8

Please sign in to comment.