function [h, l] = plotInitialize(msgId, x, t, xdata, ydata, patchMsgId)
%PLOTINITIALIZE set up current figure pulse/transition metric information
%
% This function is for internal use only.

%   Copyright 2011-2013 The MathWorks, Inc.

  clf;
  if nargin>3 && ~((isempty(xdata) || all(isnan(xdata(:)))) && (isempty(ydata) || all(isnan(ydata(:)))))
    l(1,1) = {getString(message(patchMsgId))};
    l(2,1) = {patch(xdata,ydata,0.9*ones(size(xdata)),'FaceColor',0.9*[1 1 1],'EdgeColor','none')};
    hold on
  else
    l=cell(2,0);
  end
  
  h = plot(t, x);
  xlim([t(1) t(end)]);
  l(1,end+1) = {getString(message('signal:internal:plotInitialize:LegendSignal'))};
  l(2,end) = {h};
  set(gcf,'name',getString(message(msgId)))
  hold on
end