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