From 689c89936f3b7a8a16c0d93d3d2f071a1fd32a7e Mon Sep 17 00:00:00 2001 From: Thomas Lambert <t.lambert@uliege.be> Date: Wed, 31 May 2023 16:03:25 +0200 Subject: [PATCH] feat(Result): allow LineSpec tweaks for plotperf --- src/classes/@Result/plotperf.m | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/classes/@Result/plotperf.m b/src/classes/@Result/plotperf.m index 90c312c..0749dbe 100644 --- a/src/classes/@Result/plotperf.m +++ b/src/classes/@Result/plotperf.m @@ -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) -- GitLab