function h = plot_two_labels(xdata,ydata,lab1,lab2) % PLOT_LABELED - Plots the samples with symbols depending on one class label and colors depending on another % % Written by: % -- % John L. Weatherwax 2008-11-05 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- color_choice = 'bgrcmykw'; symbols_choice = 'ox+*sdv.'; n_choices = length(color_choice); lab1_u = unique(lab1); n_lab1 = length(lab1_u); lab2_u = unique(lab2); n_lab2 = length(lab2_u); h = figure; hold on; for li1=1:n_lab1, cl1 = lab1_u(li1); for li2=1:n_lab2, cl2 = lab2_u(li2); inds = find( (lab1==cl1) & (lab2==cl2) ); sym_ind_bm = sub2ind( [n_lab1,n_lab2], li1, li2 ); sym_ind = mod(sym_ind_bm-1,n_choices)+1; plot( xdata(inds), ydata(inds), [color_choice(sym_ind),symbols_choice(sym_ind)], 'MarkerSize', 12, 'MarkerFaceColor', color_choice(sym_ind) ); end end