MATLAB Examples

## Data Visualization Contest: CREATIVITY

```load contest_data ```

## Description

The idea of the CREATIVITY visualization is to find most creative participants of the contests. They are two versions of election of the most creative authors. In the first case the most creative author write the biggest number of original lines during contest. In the second case the most creative author write the biggest number of original lines in the winner entrance.

## Lines statistics

Looking for in which entry lines appear the first time

```linestart = zeros(size(allLineList)); for k=1:size(d,2), entry = d(k).lines; for l=1:size(entry,1), if linestart(entry(l))==0, linestart(1,entry(l)) = k; end end end % Pass over two most popular lines % line 3 - 'end' % line 4 - 'function moves = solver(board)' linestart(3:4)=0; ```

## The biggest number of original lines during contest

Looking for authors of original lines

```uls = unique(linestart); uls = uls(2:end); autor = cell(size(uls)); autors = zeros(size(uls)); for k=1:size(uls,2), autor{1,k} = d(uls(k)).author; autors(1,k) = sum(uls(k)==linestart); end; % Looking for the most original authors (number of original lines) ua = unique(autor); hmc = zeros(size(ua)); for k=1:size(ua,2), hmc(1,k) = sum((strcmp(ua(k),autor)).*autors); end [hmc, nr] = sort(hmc,'descend'); % N authors with the bigest number of original lines N = 20; aut = cell(1,N); for k=1:N, aut(1,k) = ua(nr(k)); end % Figure barh(1:N,hmc(1:N)) axis([1 max(hmc(1:N)) 0 N+1]) set(gca,'YTick',1:20) set(gca,'YTickLabel',aut) xlabel('Number of the original lines') ylabel('Authors') title('Most creative authors') grid on ``` ## The biggest number of original lines in the winner entrance

The best solution

```bentry = zeros(size(d)); for k=1:size(d,2), bentry(k) = d(k).score; end bestentry = find(bentry==min(bentry)); % Lines in the best solution linestartbest = linestart(d(bestentry).lines); % Looking for authors of original lines ulsb = unique(linestartbest); ulsb = ulsb(2:end); autorb = cell(size(ulsb)); autorsb = zeros(size(ulsb)); for k=1:size(ulsb,2), autorb{1,k} = d(ulsb(k)).author; autorsb(1,k) = sum(ulsb(k)==linestartbest); end; % Looking for the most original authors (number of original lines) uab = unique(autorb); hmcb = zeros(size(uab)); for k=1:size(uab,2), hmcb(1,k) = sum((strcmp(uab(k),autorb)).*autorsb); end [hmcb, nrb] = sort(hmcb,'descend'); % N authors with the bigest number of original lines N = 20; autb = cell(1,N); for k=1:N, autb(1,k) = uab(nrb(k)); end % Figure barh(1:N,hmcb(1:N)) axis([1 max(hmcb(1:N)) 0 N+1]) set(gca,'YTick',1:20) set(gca,'YTickLabel',autb) xlabel('Number of the original lines') ylabel('Authors') title('Most creative author of the winner entrance') grid on ``` 