wolffd@0: function out = tag_stats(annots, names, max_plot) wolffd@0: % out = tag_stats(annots, names, max_plot) wolffd@0: % wolffd@0: % calculates statistics for tag distributions wolffd@0: % and plots them wolffd@0: wolffd@0: if nargin < 3 wolffd@0: max_plot = 25; wolffd@0: end wolffd@0: wolffd@0: % get overall frequency and sort accordingly wolffd@0: allapp = sum(annots > 0, 1); wolffd@0: % allapp = allapp/max(allapp); wolffd@0: wolffd@0: [null, idx] = sort(allapp,'descend'); wolffd@0: wolffd@0: % --- wolffd@0: % visualize only the fist top 200 wolffd@0: % --- wolffd@0: max_plot = min(numel(names), max_plot); wolffd@0: wolffd@0: figure; wolffd@0: bar(1:max_plot,allapp(idx(1:max_plot))) wolffd@0: set(gca,'XTick',1:max_plot); wolffd@0: set(gca,'XTickLabel',names(idx(1:max_plot))); wolffd@0: axis([1 max_plot 0 max(allapp)]) wolffd@0: wolffd@0: legend('#appearances'); wolffd@0: title 'tag statistics sorted by frequency of appearances' wolffd@0: wolffd@0: out = [];