⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plot_scatter.m

📁 Duda的《模式分类》第二版的配套的Matlab源代码
💻 M
字号:
function plot_scatter(plot_patterns, plot_targets, fig, color)

% Make a scatter plot of the data
% Inputs:
%	plot_patterns	- Data patterns
%	plot_targets	- Data targets
%	fig				- Optional figure handle
%	color			- Optional color tag (if 1, will color all points red)

switch nargin,
case 2
   color = 0;
case 3
   color = 0;
   figure(fig);
case 4
   if ~isempty(fig),
      figure(fig)
   end
end

one   = find(plot_targets == 1);
zero  = find(plot_targets == 0);

switch color
case 0
   plot(plot_patterns(1,zero),plot_patterns(2,zero),'bo',plot_patterns(1,one),plot_patterns(2,one),'gx')
case 1
   plot(plot_patterns(1,zero),plot_patterns(2,zero),'ro',plot_patterns(1,one),plot_patterns(2,one),'rx','LineWidth',2)
case 2
   plot(plot_patterns(1,zero),plot_patterns(2,zero),'ko',plot_patterns(1,one),plot_patterns(2,one),'mx')   
end

grid on

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -