tomwalters@335: % Plot a figure based on recognition data from the HTK-AIM features tomwalters@335: % experiments - a reworking of the 'spider plots' by Jess Monaghan, tomwalters@335: % Nick Fyson and Martin Vestergaard. tomwalters@335: % Copyright 2009 University of Cambridge tomwalters@335: % Author: Tom Walters tomwalters@381: function plot_all_results(exp_path, iteration, plot_end_numbers) tomwalters@381: tomwalters@381: plot_numbers = true; tomwalters@381: if nargin < 3 tomwalters@381: plot_end_numbers = false; tomwalters@381: end tomwalters@335: tomwalters@335: % Load the results from the experimental directory tomwalters@381: misclassified = load([exp_path 'misclassified_syllables_iteration_' num2str(iteration)]); tomwalters@335: tomwalters@335: % The total number of syllables in the CNBH syllable database tomwalters@335: num_points = 185; tomwalters@335: target_VTL = 15; tomwalters@335: tomwalters@381: misclassified(:, 1) = 1 - misclassified(:, 1) / num_points; tomwalters@335: tomwalters@335: % The individual data points are plotted as spheres tomwalters@335: sphere_size_x = 1.2; tomwalters@335: sphere_size_y = 0.17; tomwalters@335: sphere_size_z = 2.5; tomwalters@335: tomwalters@335: % Get the location of the various points on the spoke pattern tomwalters@335: [spokes, target] = get_spoke_points(); tomwalters@335: results = {}; tomwalters@335: tomwalters@335: % Fill the results vector tomwalters@335: for i = 1:length(spokes) tomwalters@335: results{i} = zeros(length(spokes{1}),1); tomwalters@335: r=round(spokes{i}*10)/10; tomwalters@335: for j = 1:length(spokes{i}) tomwalters@335: result = misclassified(misclassified(:,3) == r(j,2) ... tomwalters@335: & misclassified(:,2) == r(j,1), 1); tomwalters@335: if result tomwalters@335: results{i}(j) = result; tomwalters@335: else tomwalters@335: results{i}(j) = 1.0; tomwalters@335: end tomwalters@335: end tomwalters@335: results{i} = 100.0 * results{i}; tomwalters@335: spokes{i}(:,2) = target_VTL * target(2) ./ spokes{i}(:,2); tomwalters@335: end tomwalters@335: tomwalters@335: figure1 = figure; tomwalters@335: axes1 = axes('Parent',figure1,'YScale','log','YMinorTick','on',... tomwalters@335: 'YMinorGrid','on',... tomwalters@335: 'XScale','log',... tomwalters@335: 'XMinorTick','on',... tomwalters@335: 'XMinorGrid','on'); tomwalters@335: tomwalters@335: shades = 50; tomwalters@335: cmap = fliplr(autumn(shades)); tomwalters@335: for i=1:length(spokes) tomwalters@335: tomwalters@335: hold on; tomwalters@335: j=1; tomwalters@335: x_pos = spokes{i}(j, 1); tomwalters@335: y_pos = spokes{i}(j, 2); tomwalters@335: z_pos = results{i}(j); tomwalters@335: j=2; tomwalters@335: x_pos_2 = spokes{i}(j, 1); tomwalters@335: y_pos_2 = spokes{i}(j, 2); tomwalters@335: z_pos_2 = results{i}(j); tomwalters@335: tomwalters@381: j=1; tomwalters@381: tomwalters@381: if (~plot_numbers && plot_end_numbers) tomwalters@381: text(x_pos + 0.3*(x_pos - x_pos_2), y_pos + 0.3*(y_pos - y_pos_2), z_pos + 0.3*(z_pos - z_pos_2) , [num2str(results{i}(j), 3) '%']); tomwalters@381: end tomwalters@335: for j = 1:length(spokes{i}) tomwalters@381: if (plot_numbers) tomwalters@381: text(spokes{i}(j,1), spokes{i}(j,2), results{i}(j), [num2str(results{i}(j), 3) '%']); tomwalters@381: else tomwalters@381: [X Y Z] = sphere(10); tomwalters@381: X = sphere_size_x.*X + spokes{i}(j,1); tomwalters@381: Y = sphere_size_y.*Y + spokes{i}(j,2); tomwalters@381: Z = sphere_size_z.*Z + results{i}(j); tomwalters@381: % C = zeros(size(X)); tomwalters@381: plot3([spokes{i}(j, 1) spokes{i}(j, 1)], ... tomwalters@381: [spokes{i}(j, 2),spokes{i}(j, 2)], [0 results{i}(j)], '-k.', ... tomwalters@381: 'LineWidth', 1, 'Color', [0.8 0.8 0.8]); tomwalters@381: surf(X, Y, Z, ones(size(Z)) .* (results{i}(j)), 'LineStyle', 'none'); tomwalters@381: end tomwalters@335: end tomwalters@381: if (~plot_numbers) tomwalters@381: plot3(spokes{i}(:,1), spokes{i}(:,2), results{i}(:), '-', 'LineWidth', 2, ... tomwalters@381: 'Color', [0.2 0.2 0.2]); tomwalters@381: end tomwalters@335: end tomwalters@335: % Plot a zero-sized sphere at zero to get the autoscaling of the colour bar tomwalters@335: % correct tomwalters@335: [X Y Z] = sphere(20); tomwalters@335: X = zeros(size(X)) - 1; tomwalters@335: surf(X, X, X, ones(size(Z)) .* 0, 'LineStyle', 'none'); tomwalters@335: %colorbar('WestOutside'); tomwalters@335: view([-80 60]); tomwalters@335: grid('on'); tomwalters@335: xlim([132 224]); tomwalters@335: zlim([0 100]); tomwalters@335: ylim([10 22]); tomwalters@335: set(gca, 'FontSize', 12); tomwalters@335: %set(gca, 'FontName', 'Hoefler Text'); tomwalters@335: xlabel('GPR /Hz'); tomwalters@335: ylabel('VTL /cm'); tomwalters@335: zlabel('Percent correct'); tomwalters@335: set(axes1, 'YScale', 'log'); tomwalters@335: set(axes1, 'XScale', 'log'); tomwalters@335: set(axes1, 'XTick', [132 172 224]); tomwalters@335: set(axes1, 'YTick', [10 15 22]); tomwalters@335: set(axes1, 'YDir', 'reverse'); tomwalters@335: set(axes1, 'ZTick', [0 20 40 60 80 100]); tomwalters@335: hold('all'); tomwalters@381: %print('-depsc', [exp_path 'results_plot_iteration_' num2str(iteration) '.eps']); tomwalters@381: % saveas(gcf, [exp_path 'results_plot_iteration_' num2str(iteration) '.fig']); tomwalters@381: %!open results_plot.eps tomwalters@335: tomwalters@335: tomwalters@335: