MATLAB Examples

Data Visualization Contest

This is a very simple entry: a plot of the scores of incoming entries versus when they first appeared.

load contest_data

t = [d.timestamp];
s = [d.score];
semilogy(t, s, '.')

If we normalize the score to make the lowest answer equal to one, it's easier to see what's going on.

minScore = min(s);
normScore = s-minScore+1;
semilogy(t, normScore, '.')
ylabel('Normalized Score')

Find the leaders

best = d(1).score;
bestIndexList = 1;
for n = 1:length(d),
    if d(n).score < best,
        best = d(n).score;
        bestIndexList = [bestIndexList n];

Now plot them in red on top of the previous plot

hold on
plot(t(bestIndexList), normScore(bestIndexList), 'r.-')
hold off