function p = getNicholsPlotOpts(p,h,varargin)
%GETNICHOLSPLOTOPTS Gets plot options of @nichols plot h and assigns them to p 

%  Author(s): C. Buhr
%  Copyright 1986-2005 The MathWorks, Inc.
%  $Revision: 1.1.6.1.2.1 $ $Date: 2005/01/10 00:35:15 $

if isempty(varargin) 
   allflag = false;
else
    allflag = varargin{1};
end


p.FreqUnits = h.FrequencyUnits;
p.PhaseUnits = h.AxesGrid.XUnits;

if strcmp(h.Preferences.UnwrapPhase,'on')
    p.PhaseWrapping = 'off';
else
    p.PhaseWrapping = 'on';
end

if strcmp(h.Preference.MinGainLimit.Enable,'on')
    p.MagLowerLimMode = 'manual';
else
    p.MagLowerLimMode = 'auto';
end
p.MagLowerLim = h.Preference.MinGainLimit.MinGain;

ComparePhase = h.Preferences.ComparePhase;

p.PhaseMatching = ComparePhase.Enable;
p.PhaseMatchingFreq = ComparePhase.Freq;
p.PhaseMatchingValue = ComparePhase.Phase;


if allflag
    p = getRespPlotOpts(p,h,allflag);
end