function plot(this, varargin)
%PLOT Plot Bayesian Optimization results
%   (1) plot(RESULTS) or plot(RESULTS, 'all') calls all
%       pre-defined plot functions on RESULTS.
%
%   (2) plot(RESULTS, plotFcn1, plotFcn2, ...) calls plot
%       functions plotFcn1, plotFcn2, ... on RESULTS.
%
% Pre-defined plot functions:
%     @plotObjectiveModel
%     @plotAcquisitionFunction
%     @plotObjectiveEvaluationTimeModel
%     @plotConstraintModels
%     @plotObjective
%     @plotObjectiveEvaluationTime
%     @plotMinObjective
%     @plotElapsedTime
%

%   Copyright 2016-2022 The MathWorks, Inc.

[varargin{:}] = convertStringsToChars(varargin{:});
C = bayesoptim.suppressWarnings();
if isempty(varargin) || isequal(varargin{1}, 'all')
    PlotFcn = {...
        @plotObjectiveModel,...
        @plotAcquisitionFunction,...
        @plotObjectiveEvaluationTimeModel,...
        @plotConstraintModels,...
        @plotObjective,...
        @plotObjectiveEvaluationTime,...
        @plotMinObjective,...
        @plotElapsedTime};
else
    PlotFcn = varargin;
end
if ~all(cellfun(@(x)isa(x, 'function_handle'), PlotFcn))
    bayesoptim.err('PlotArgs');
end
for i = 1:numel(PlotFcn)
    PlotFcn{i}(this, 'standalone');
end
drawnow;
end
