function plotResultForOneParameterScan(XParameter, YQuantity, varargin) p = inputParser; p.KeepUnmatched = true; addRequired(p, 'ParameterArray', @isvector) addRequired(p, 'QuantityOfInterestArray', @ismatrix) addParameter(p, 'RescalingFactorForParameter', 1, @isscalar) addParameter(p, 'XLabelString', 'X parameter', @ischar) addParameter(p, 'ErrorsForYQuantity', false, @islogical) addParameter(p, 'ErrorsArray', [], @isvector) addParameter(p, 'CIForYQuantity', false, @islogical) addParameter(p, 'CIArray', [], @ismatrix) addParameter(p, 'RescalingFactorForYQuantity', 1, @isscalar) addParameter(p, 'RemoveOutliers', false, @islogical) addParameter(p, 'YLabelString', 'Y parameter', @ischar) addParameter(p, 'TitleString', 'One-Parameter Scan', @ischar) p.parse(XParameter, YQuantity, varargin{:}) XParameter = p.Results.ParameterArray; RescalingFactorForXParameter = p.Results.RescalingFactorForParameter; XLabelString = p.Results.XLabelString; YQuantity = p.Results.QuantityOfInterestArray; ErrorsForYQuantity = p.Results.ErrorsForYQuantity; ErrorsArray = p.Results.ErrorsArray; CIForYQuantity = p.Results.CIForYQuantity; CIArray = p.Results.CIArray; RescalingFactorForYQuantity = p.Results.RescalingFactorForYQuantity; RemoveOutliers = p.Results.RemoveOutliers; YLabelString = p.Results.YLabelString; TitleString = p.Results.TitleString; f_h = Helper.getFigureByTag('One-Parameter Scan'); set(groot,'CurrentFigure',f_h); a_h = get(f_h, 'CurrentAxes'); if ~isempty(get(a_h, 'Children')) clf(f_h); end f_h.Name = 'One-Parameter Scan'; f_h.Units = 'pixels'; set(0,'units','pixels'); screensize = get(0,'ScreenSize'); f_h.Position = [[screensize(3)/3.5 screensize(4)/3.5] 750 600]; if RemoveOutliers [YQuantity,TF] = rmoutliers(YQuantity); XParameter = XParameter(~TF); ErrorsArray = ErrorsArray(~TF); ClippedCIArray(:,1) = CIArray(~TF,1); ClippedCIArray(:,2) = CIArray(~TF,2); CIArray = ClippedCIArray; end RescaledXParameter = XParameter .* RescalingFactorForXParameter; RescaledYQuantity = YQuantity .* RescalingFactorForYQuantity; hold on if ErrorsForYQuantity RescaledErrorsArray = ErrorsArray .* RescalingFactorForYQuantity; errorbar(RescaledXParameter, RescaledYQuantity, RescaledErrorsArray, 'o', 'Linewidth', 1.5, 'MarkerFaceColor', '#0071BB') else plot(RescaledXParameter, RescaledYQuantity, '--o', 'Linewidth', 1.5); end if CIForYQuantity RescaledCIArray = CIArray .* RescalingFactorForYQuantity; Plotter.plotConfidenceIntervalRegion(RescaledXParameter, RescaledCIArray(:,1), RescaledCIArray(:,2)); end hold off xlim([0 inf]) ylim([0 inf]) hXLabel = xlabel(XLabelString); hYLabel = ylabel(YLabelString); hTitle = sgtitle(TitleString); set([hXLabel, hYLabel] , ... 'FontSize' , 14 ); set( hTitle , ... 'FontSize' , 18 ); grid on Helper.bringFiguresWithTagInForeground(); end