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)
DEF.base_oper = self.operPts.Properties.VariableNames;
DEF.allowed_oper = [DEF.base_oper, 'advRat']; % Also allows advance ratio
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
[perf, oper, solvers, operPt, newFig] = parseinputs(DEF, varargin{:});
[perf, oper, solvers, operPt, newFig, lineSpec] = parseinputs(DEF, varargin{:});
% Plot the figure
if newFig
......@@ -61,7 +65,6 @@ function plotperf(self, varargin)
for iSolv = 1:length(solvers)
thissolv = solvers{iSolv};
if ~isempty(self.(thissolv))
if strcmpi(oper, 'advRat')
operVect = vectorize(filtered.(thissolv), 'advanceRatio');
......@@ -70,14 +73,14 @@ function plotperf(self, varargin)
end
dataVect = vectorize(filtered.(thissolv), perf);
plot(operVect, dataVect, 'DisplayName', solvers{iSolv});
plot(operVect, dataVect, lineSpec.(thissolv){:}, 'DisplayName', thissolv);
hold on;
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
% - 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)
addRequired(p, 'collective', valData);
addParameter(p, 'solvers', DEF.ALLOWED_SOLVERS);
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{:});
perf = p.Results.perf;
......@@ -110,6 +117,12 @@ function [perf, oper, solvers, operPt, newFig] = parseinputs(DEF, varargin)
operPt.(p.Results.oper) = NaN;
end
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
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