comparison core/magnatagatune/tag_stats.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function out = tag_stats(annots, names, max_plot)
2 % out = tag_stats(annots, names, max_plot)
3 %
4 % calculates statistics for tag distributions
5 % and plots them
6
7 if nargin < 3
8 max_plot = 25;
9 end
10
11 % get overall frequency and sort accordingly
12 allapp = sum(annots > 0, 1);
13 % allapp = allapp/max(allapp);
14
15 [null, idx] = sort(allapp,'descend');
16
17 % ---
18 % visualize only the fist top 200
19 % ---
20 max_plot = min(numel(names), max_plot);
21
22 figure;
23 bar(1:max_plot,allapp(idx(1:max_plot)))
24 set(gca,'XTick',1:max_plot);
25 set(gca,'XTickLabel',names(idx(1:max_plot)));
26 axis([1 max_plot 0 max(allapp)])
27
28 legend('#appearances');
29 title 'tag statistics sorted by frequency of appearances'
30
31 out = [];