Skip to content
Snippets Groups Projects
Verified Commit 689c8993 authored by Thomas Lambert's avatar Thomas Lambert :helicopter:
Browse files

feat(Result): allow LineSpec tweaks for plotperf

parent 756aa88e
No related branches found
No related tags found
No related merge requests found
...@@ -48,9 +48,13 @@ function plotperf(self, varargin) ...@@ -48,9 +48,13 @@ function plotperf(self, varargin)
DEF.base_oper = self.operPts.Properties.VariableNames; DEF.base_oper = self.operPts.Properties.VariableNames;
DEF.allowed_oper = [DEF.base_oper, 'advRat']; % Also allows advance ratio DEF.allowed_oper = [DEF.base_oper, 'advRat']; % Also allows advance ratio
DEF.ALLOWED_SOLVERS = {'leishman', 'indfact', 'indvel', 'stahlhut'}; DEF.ALLOWED_SOLVERS = {'leishman', 'indfact', 'indvel', 'stahlhut'};
DEF.LEISHMAN_LINE = {'LineStyle', '-', 'color', 'red'};
DEF.INDFACT_LINE = {'LineStyle', ':', 'color', 'magenta'};
DEF.INDVEL_LINE = {'LineStyle', '--', 'color', 'blue'};
DEF.STAHLHUT_LINE = {'LineStyle', '-.', 'color', 'green'};
% Parse inputs % Parse inputs
[perf, oper, solvers, operPt, newFig] = parseinputs(DEF, varargin{:}); [perf, oper, solvers, operPt, newFig, lineSpec] = parseinputs(DEF, varargin{:});
% Plot the figure % Plot the figure
if newFig if newFig
...@@ -61,7 +65,6 @@ function plotperf(self, varargin) ...@@ -61,7 +65,6 @@ function plotperf(self, varargin)
for iSolv = 1:length(solvers) for iSolv = 1:length(solvers)
thissolv = solvers{iSolv}; thissolv = solvers{iSolv};
if ~isempty(self.(thissolv)) if ~isempty(self.(thissolv))
if strcmpi(oper, 'advRat') if strcmpi(oper, 'advRat')
operVect = vectorize(filtered.(thissolv), 'advanceRatio'); operVect = vectorize(filtered.(thissolv), 'advanceRatio');
...@@ -70,14 +73,14 @@ function plotperf(self, varargin) ...@@ -70,14 +73,14 @@ function plotperf(self, varargin)
end end
dataVect = vectorize(filtered.(thissolv), perf); dataVect = vectorize(filtered.(thissolv), perf);
plot(operVect, dataVect, 'DisplayName', solvers{iSolv}); plot(operVect, dataVect, lineSpec.(thissolv){:}, 'DisplayName', thissolv);
hold on; hold on;
end end
end end
end end
function [perf, oper, solvers, operPt, newFig] = parseinputs(DEF, varargin) function [perf, oper, solvers, operPt, newFig, lineSpec] = parseinputs(DEF, varargin)
% PARSEINPUTS Parse the varargin inputs % PARSEINPUTS Parse the varargin inputs
% - Only the parameter corresponding to oper can be nan, all others need to be defined % - Only the parameter corresponding to oper can be nan, all others need to be defined
...@@ -93,6 +96,10 @@ function [perf, oper, solvers, operPt, newFig] = parseinputs(DEF, varargin) ...@@ -93,6 +96,10 @@ function [perf, oper, solvers, operPt, newFig] = parseinputs(DEF, varargin)
addRequired(p, 'collective', valData); addRequired(p, 'collective', valData);
addParameter(p, 'solvers', DEF.ALLOWED_SOLVERS); addParameter(p, 'solvers', DEF.ALLOWED_SOLVERS);
addParameter(p, 'newFig', false, valLogi); addParameter(p, 'newFig', false, valLogi);
addParameter(p, 'leishmanLine', DEF.LEISHMAN_LINE);
addParameter(p, 'indfactLine', DEF.INDFACT_LINE);
addParameter(p, 'indvelLine', DEF.INDVEL_LINE);
addParameter(p, 'stahlhutLine', DEF.STAHLHUT_LINE);
parse(p, varargin{:}); parse(p, varargin{:});
perf = p.Results.perf; perf = p.Results.perf;
...@@ -110,6 +117,12 @@ function [perf, oper, solvers, operPt, newFig] = parseinputs(DEF, varargin) ...@@ -110,6 +117,12 @@ function [perf, oper, solvers, operPt, newFig] = parseinputs(DEF, varargin)
operPt.(p.Results.oper) = NaN; operPt.(p.Results.oper) = NaN;
end end
newFig = p.Results.newFig; newFig = p.Results.newFig;
lineSpec.leishman = p.Results.leishmanLine;
lineSpec.indfact = p.Results.indfactLine;
lineSpec.indvel = p.Results.indvelLine;
lineSpec.stahlhut = p.Results.stahlhutLine;
end end
function vect = vectorize(struct, prop) function vect = vectorize(struct, prop)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment