📄 plotroc.m
字号:
function h = plotroc(e,varargin)%PLOTROC Draw an ROC curve%% H = PLOTROC(E)%% Plot the roc curve of E according to the 'traditional' way: on the x% axis we put the false positive (outliers accepted) and on the y axis% we put the true positive (targets accepted).%% H = PLOTROC(E,LINESTYLE)%% When required, a second argument can be given, indicating the color,% LINESTYLE and markers of the plot. See 'plot' for the possibilities.%% See also dd_error, dd_roc, dd_auc% Copyright: D.M.J. Tax, R.P.W. Duin, duin@ph.tn.tudelft.nl% Faculty of Applied Physics, Delft University of Technology% P.O. Box 5046, 2600 GA Delft, The Netherlands% default settings:mrk = 'b-';fs = 16;lw = 2;oldplot=0;% Be a bit flexible, and try to detect when one wants to use the% old/nonstandard ROC curve:if ~isempty(varargin) if length(varargin)>1 %Both color and oldplot are given if ~isempty(varargin{1}) oldplot = 1; end mrk = varargin{end}; else %Only color or oldplot is given if ischar(varargin{1}) mrk = varargin{1}; else oldplot = 1; end endend% transpose e if required:if size(e,1)==2 e = e';end% and here we plot:if oldplot>0 h = plot(e(:,1), e(:,2),mrk); xlabel('targets rejected (FN)','fontsize',fs); ylabel('outliers accepted (FP)','fontsize',fs);else h = plot(e(:,2), 1-e(:,1),mrk); xlabel('outliers accepted (FP)','fontsize',fs); ylabel('targets accepted (TP)','fontsize',fs);endset(h,'linewidth',lw);% Want this in most cases:axis([0 1 0 1]);hold on;% If no handles are requested, remove them:if nargout==0 clear h;endreturn
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -