annotate trunk/experiments/scripts/cnbh-syllables/results_plotting/plot_all_results.m @ 342:4ca26619a4b6

- AWS (part 4)
author tomwalters
date Wed, 11 Aug 2010 09:12:05 +0000
parents 71c438f9daf7
children e6f006238034
rev   line source
tomwalters@335 1 % Plot a figure based on recognition data from the HTK-AIM features
tomwalters@335 2 % experiments - a reworking of the 'spider plots' by Jess Monaghan,
tomwalters@335 3 % Nick Fyson and Martin Vestergaard.
tomwalters@335 4 % Copyright 2009 University of Cambridge
tomwalters@335 5 % Author: Tom Walters <tcw24@cam>
tomwalters@335 6 function plot_all_results(exp_path)
tomwalters@335 7
tomwalters@335 8 % Load the results from the experimental directory
tomwalters@335 9 load([exp_path 'misclassified.txt_iter15']);
tomwalters@335 10
tomwalters@335 11 % The total number of syllables in the CNBH syllable database
tomwalters@335 12 num_points = 185;
tomwalters@335 13 target_VTL = 15;
tomwalters@335 14
tomwalters@335 15 misclassified(:, 1) = 1 - misclassified(:, 1) / num_points; %#ok<NODEF>
tomwalters@335 16
tomwalters@335 17 % The individual data points are plotted as spheres
tomwalters@335 18 sphere_size_x = 1.2;
tomwalters@335 19 sphere_size_y = 0.17;
tomwalters@335 20 sphere_size_z = 2.5;
tomwalters@335 21
tomwalters@335 22 % Get the location of the various points on the spoke pattern
tomwalters@335 23 [spokes, target] = get_spoke_points();
tomwalters@335 24 results = {};
tomwalters@335 25
tomwalters@335 26 % Fill the results vector
tomwalters@335 27 for i = 1:length(spokes)
tomwalters@335 28 results{i} = zeros(length(spokes{1}),1);
tomwalters@335 29 r=round(spokes{i}*10)/10;
tomwalters@335 30 for j = 1:length(spokes{i})
tomwalters@335 31 result = misclassified(misclassified(:,3) == r(j,2) ...
tomwalters@335 32 & misclassified(:,2) == r(j,1), 1);
tomwalters@335 33 if result
tomwalters@335 34 results{i}(j) = result;
tomwalters@335 35 else
tomwalters@335 36 results{i}(j) = 1.0;
tomwalters@335 37 end
tomwalters@335 38 end
tomwalters@335 39 results{i} = 100.0 * results{i};
tomwalters@335 40 spokes{i}(:,2) = target_VTL * target(2) ./ spokes{i}(:,2);
tomwalters@335 41 end
tomwalters@335 42
tomwalters@335 43 figure1 = figure;
tomwalters@335 44 axes1 = axes('Parent',figure1,'YScale','log','YMinorTick','on',...
tomwalters@335 45 'YMinorGrid','on',...
tomwalters@335 46 'XScale','log',...
tomwalters@335 47 'XMinorTick','on',...
tomwalters@335 48 'XMinorGrid','on');
tomwalters@335 49
tomwalters@335 50 shades = 50;
tomwalters@335 51 cmap = fliplr(autumn(shades));
tomwalters@335 52 for i=1:length(spokes)
tomwalters@335 53
tomwalters@335 54 hold on;
tomwalters@335 55 j=1;
tomwalters@335 56 x_pos = spokes{i}(j, 1);
tomwalters@335 57 y_pos = spokes{i}(j, 2);
tomwalters@335 58 z_pos = results{i}(j);
tomwalters@335 59 j=2;
tomwalters@335 60 x_pos_2 = spokes{i}(j, 1);
tomwalters@335 61 y_pos_2 = spokes{i}(j, 2);
tomwalters@335 62 z_pos_2 = results{i}(j);
tomwalters@335 63
tomwalters@335 64 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@335 65 for j = 1:length(spokes{i})
tomwalters@335 66 [X Y Z] = sphere(10);
tomwalters@335 67 X = sphere_size_x.*X + spokes{i}(j,1);
tomwalters@335 68 Y = sphere_size_y.*Y + spokes{i}(j,2);
tomwalters@335 69 Z = sphere_size_z.*Z + results{i}(j);
tomwalters@335 70 % C = zeros(size(X));
tomwalters@335 71 plot3([spokes{i}(j, 1) spokes{i}(j, 1)], ...
tomwalters@335 72 [spokes{i}(j, 2),spokes{i}(j, 2)], [0 results{i}(j)], '-k.', ...
tomwalters@335 73 'LineWidth', 1, 'Color', [0.8 0.8 0.8]);
tomwalters@335 74 surf(X, Y, Z, ones(size(Z)) .* (results{i}(j)), 'LineStyle', 'none');
tomwalters@335 75 end
tomwalters@335 76 plot3(spokes{i}(:,1), spokes{i}(:,2), results{i}(:), '-', 'LineWidth', 2, ...
tomwalters@335 77 'Color', [0.2 0.2 0.2]);
tomwalters@335 78 end
tomwalters@335 79 % Plot a zero-sized sphere at zero to get the autoscaling of the colour bar
tomwalters@335 80 % correct
tomwalters@335 81 [X Y Z] = sphere(20);
tomwalters@335 82 X = zeros(size(X)) - 1;
tomwalters@335 83 surf(X, X, X, ones(size(Z)) .* 0, 'LineStyle', 'none');
tomwalters@335 84 %colorbar('WestOutside');
tomwalters@335 85 view([-80 60]);
tomwalters@335 86 grid('on');
tomwalters@335 87 xlim([132 224]);
tomwalters@335 88 zlim([0 100]);
tomwalters@335 89 ylim([10 22]);
tomwalters@335 90 set(gca, 'FontSize', 12);
tomwalters@335 91 %set(gca, 'FontName', 'Hoefler Text');
tomwalters@335 92 xlabel('GPR /Hz');
tomwalters@335 93 ylabel('VTL /cm');
tomwalters@335 94 zlabel('Percent correct');
tomwalters@335 95 set(axes1, 'YScale', 'log');
tomwalters@335 96 set(axes1, 'XScale', 'log');
tomwalters@335 97 set(axes1, 'XTick', [132 172 224]);
tomwalters@335 98 set(axes1, 'YTick', [10 15 22]);
tomwalters@335 99 set(axes1, 'YDir', 'reverse');
tomwalters@335 100 set(axes1, 'ZTick', [0 20 40 60 80 100]);
tomwalters@335 101 hold('all');
tomwalters@335 102 print('-depsc', 'results_plot.eps');
tomwalters@335 103 !open results_plot.eps
tomwalters@335 104
tomwalters@335 105
tomwalters@335 106