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

📄 plot_scatter.m

📁 最新的模式识别分类工具箱,希望对朋友们有用!
💻 M
字号:
function plot_scatter(plot_features, plot_targets, fig, color)% Make a scatter plot of the data% Inputs:%	plot_features	- Data features%	plot_targets	- Data targets%	fig				- Optional figure handle%	color				- Optional color tag (if 1, will color all points red)colors  = 'bgrmk';marks   = 'oxd*v^h<>s.';ncolors = length(colors);nmarks  = length(marks);switch nargin,case 2   color = 0;case 3   color = 0;   figure(fig);case 4   if ~isempty(fig),      figure(fig)   endendone   = find(plot_targets == 1);zero  = find(plot_targets == 0);switch colorcase 0  [Nclasses, classes] = find_classes(plot_targets);  for  cl = 1:Nclasses,    if (Nclasses < ncolors)      colorIndex = cl;      markIndex  = cl;    else      colorIndex = ceil(rand(1,1) * ncolors);      markIndex  = ceil(rand(1,1) * nmarks);    end    plotMark = sprintf('%c%c',colors(colorIndex),marks(markIndex));    ind      = find(plot_targets == classes(cl));    plot(plot_features(1,ind),plot_features(2,ind),plotMark);    if ( cl==1) hold on; end  end   hold off;case 1   plot(plot_features(1,zero),plot_features(2,zero),'ro',plot_features(1,one),plot_features(2,one),'rx','LineWidth',2)case 2   plot(plot_features(1,zero),plot_features(2,zero),'ko',plot_features(1,one),plot_features(2,one),'mx')   endgrid on

⌨️ 快捷键说明

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