Skip to content

Commit c944de7

Browse files
authored
Replaces varargin in bayesShadedPlot with argument block (#282)
1 parent fcc187d commit c944de7

File tree

5 files changed

+14
-38
lines changed

5 files changed

+14
-38
lines changed
57.6 KB
Binary file not shown.

examples/normalReflectivity/customXY/customXYDSPCScript.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
% ..and plot this out....
189189

190190
figure(30); clf;
191-
bayesShadedPlot(problem, results,'KeepAxes',true,'interval',65,'q4',false)
191+
bayesShadedPlot(problem, results,'keepAxes',true,'interval',65,'q4',false)
192192

193193
h3 = figure(40); clf
194194
plotHists(results,h3,'smooth',true)
219 Bytes
Binary file not shown.

utilities/plotting/bayesShadedPlot.m

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,25 @@
1-
function bayesShadedPlot(problem,result,varargin)
2-
1+
function bayesShadedPlot(problem, result, options)
32
% Plot the shaded reflectivities from Bayes output
43
% from RAT
4+
arguments
5+
problem
6+
result
7+
options.q4 {logical} = false
8+
options.keepAxes {logical} = false
9+
options.interval {mustBeMember(options.interval, [65, 95])} = 95
10+
end
511

612
if isa(problem,'domainsClass')
713
isDomains = true;
814
else
915
isDomains = false;
1016
end
1117

12-
% Parse the input options
13-
if ~isempty(varargin)
14-
15-
defaultq4 = false;
16-
defaultKeep = false;
17-
defaultInterval = 95;
18-
19-
allIntervals = [65 95];
20-
21-
p = inputParser;
22-
addOptional(p, 'q4', defaultq4, @islogical);
23-
addOptional(p, 'KeepAxes', defaultKeep, @islogical);
24-
addOptional(p, 'interval', defaultInterval, @(x) ismember(x,allIntervals));
25-
26-
parse(p,varargin{:});
27-
inputBlock = p.Results;
28-
29-
q4 = inputBlock.q4;
30-
keepAx = inputBlock.KeepAxes;
31-
interval = inputBlock.interval;
32-
33-
else
34-
35-
q4 = false;
36-
keepAx = false;
37-
interval = 95;
38-
39-
end
40-
41-
42-
if ~keepAx
18+
if ~options.keepAxes
4319
clf; hold on; box on
4420
end
4521

46-
switch interval
22+
switch options.interval
4723
case 95
4824
vals = [1 5];
4925
case 65
@@ -75,7 +51,7 @@ function bayesShadedPlot(problem,result,varargin)
7551
reflectivity = bestReflectivity{i};
7652

7753
mult = 2^(4*i);
78-
switch q4
54+
switch options.q4
7955
case true
8056
thisQ4 = thisData(:,1).^4;
8157
case false
@@ -99,7 +75,7 @@ function bayesShadedPlot(problem,result,varargin)
9975
refXValues = result.reflectivity{i}(:,1);
10076
thisSimQ4 = refXValues.^4;
10177

102-
switch q4
78+
switch options.q4
10379
case true
10480
min = min .* thisSimQ4;
10581
max = max .* thisSimQ4;

utilities/plotting/plotBayes.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function plotBayes(problem, results)
33
figure(10); clf; plotRefSLD(problem,results)
44

55
figure(30); clf;
6-
bayesShadedPlot(problem,results,'KeepAxes',true,'interval',95,'q4',false)
6+
bayesShadedPlot(problem,results,'keepAxes',true,'interval',95,'q4',false)
77

88
h3 = figure(40); clf
99
plotHists(results,h3,'smooth',true)

0 commit comments

Comments
 (0)