Skip to content

Commit 2feb077

Browse files
committed
Add linewidth parameter to PaperPlot
Introduced a new `lw` parameter to allow customization of plot line thickness, defaulting to 1. Updated all relevant plot and axis calls to use this parameter.
1 parent 959b4a8 commit 2feb077

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

PaperPlot.m

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ function PaperPlot(MRS_struct, varargin)
2929
% signalLim: Limits of signal axis, entered as a two-element
3030
% vector. Default is an empty vector (automatic
3131
% scaling; recommended).
32+
% lw: Set line thickness of plot lines, entered as a
33+
% numeric value. Default is 1.
3234
% plotModel: Plot signal model fit(s), entered as a logical.
3335
% Default is false.
3436
% plotResid: If plotModel is true, also plot the model residuals,
@@ -81,6 +83,7 @@ function PaperPlot(MRS_struct, varargin)
8183
defaultnSpec = 1:length(MRS_struct.metabfile);
8284
defaultFreqLim = [0.5 4.5];
8385
defaultSignalLim = [];
86+
defaultLW = 1;
8487
defaultPlotModel = false;
8588
defaultPlotResid = true;
8689
defaultPlotAvg = false;
@@ -100,6 +103,7 @@ function PaperPlot(MRS_struct, varargin)
100103
p.addParameter('specNum', defaultnSpec, @(x) isvector(x));
101104
p.addParameter('freqLim', defaultFreqLim, @(x) isvector(x) && numel(x) == 2);
102105
p.addParameter('signalLim', defaultSignalLim, @(x) isvector(x) && numel(x) == 2);
106+
p.addParameter('lw', defaultLW, @(x) isnumeric(x));
103107
p.addParameter('plotModel', defaultPlotModel, @(x) islogical(x));
104108
p.addParameter('plotResid', defaultPlotResid, @(x) islogical(x));
105109
p.addParameter('plotAvg', defaultPlotAvg, @(x) islogical(x));
@@ -117,6 +121,7 @@ function PaperPlot(MRS_struct, varargin)
117121
specNum = p.Results.specNum;
118122
freqLim = p.Results.freqLim;
119123
signalLim = p.Results.signalLim;
124+
lw = p.Results.lw;
120125
plotModel = p.Results.plotModel;
121126
plotResid = p.Results.plotResid;
122127
plotAvg = p.Results.plotAvg;
@@ -238,7 +243,7 @@ function PaperPlot(MRS_struct, varargin)
238243
elseif plotCI
239244
patch([freq fliplr(freq)], [UB.ci fliplr(LB.ci)], 1, 'FaceColor', grey+(1-grey)*(1-shading), 'EdgeColor', 'none');
240245
end
241-
h = plot(freq, mu, 'Color', [0 0 0], 'LineWidth', 1);
246+
h = plot(freq, mu, 'Color', [0 0 0], 'LineWidth', lw);
242247
hold off;
243248

244249
else
@@ -249,15 +254,15 @@ function PaperPlot(MRS_struct, varargin)
249254
if strcmp(target{jj}, 'GABAGlx')
250255
h(:,kk) = plot(freq, real(MRS_struct.spec.(vox{ii}).(target{jj}).(diff)(specNum(kk),:)) - baseMean(kk,:), ...
251256
modelFreq, model(MRS_struct.out.(vox{ii}).GABA.ModelParam(specNum(kk),:),modelFreq) ./ scaleFactor(kk) - baseMean(kk,1), ...
252-
'LineWidth', 1);
257+
'LineWidth', lw);
253258
else
254259
h(:,kk) = plot(freq, real(MRS_struct.spec.(vox{ii}).(target{jj}).(diff)(specNum(kk),:)) - baseMean(kk,:), ...
255-
modelFreq, model(MRS_struct.out.(vox{ii}).(target{jj}).ModelParam(specNum(kk),:),modelFreq) ./ scaleFactor(kk) - baseMean(kk,1), 'LineWidth', 1);
260+
modelFreq, model(MRS_struct.out.(vox{ii}).(target{jj}).ModelParam(specNum(kk),:),modelFreq) ./ scaleFactor(kk) - baseMean(kk,1), 'LineWidth', lw);
256261
end
257262
h(1,kk).Color = [0 0 0];
258263
h(2,kk).Color = [1 0 0];
259264
else
260-
h(:,kk) = plot(freq, real(MRS_struct.spec.(vox{ii}).(target{jj}).(diff)(specNum(kk),:)) - baseMean(kk,:), 'Color', [0 0 0], 'LineWidth', 1);
265+
h(:,kk) = plot(freq, real(MRS_struct.spec.(vox{ii}).(target{jj}).(diff)(specNum(kk),:)) - baseMean(kk,:), 'Color', [0 0 0], 'LineWidth', lw);
261266
end
262267
if plotResid && plotModel
263268
if strcmp(target{jj}, 'GABAGlx')
@@ -269,7 +274,7 @@ function PaperPlot(MRS_struct, varargin)
269274
end
270275
dataMin = min(real(MRS_struct.spec.(vox{ii}).(target{jj}).(diff)(specNum(kk), residInd)),[],2);
271276
resid = resid + dataMin - 1.5*max(resid);
272-
plot(modelFreq, resid, 'Color', [0 0 0], 'LineWidth', 1);
277+
plot(modelFreq, resid, 'Color', [0 0 0], 'LineWidth', lw);
273278
end
274279
end
275280
hold off;
@@ -326,7 +331,7 @@ function PaperPlot(MRS_struct, varargin)
326331
end
327332

328333
set(gca, 'TickDir', 'out', 'XLim', freqLim, 'XDir', 'reverse', 'Box', 'off', ...
329-
'FontSize', 20, 'LineWidth', 1, 'XColor', [0 0 0], 'YColor', [0 0 0]);
334+
'FontSize', 20, 'LineWidth', lw, 'XColor', [0 0 0], 'YColor', [0 0 0]);
330335
set(get(gca,'YAxis'),'Visible','off');
331336
xlabel('ppm', 'FontWeight', 'bold', 'FontSize', 28, 'Color', [0 0 0]);
332337

0 commit comments

Comments
 (0)