image thumbnail

Animation of result vs. cpu_time by day

by

 

This is a DATAVIZ contest entry showing an animation of result vs. cpu_time

MATLAB DATAVIS Contest

MATLAB DATAVIS Contest

Entry for the Spring 2009 MATLAB Data Visualization Contest

Author: Alan Chalker

Creation Date: 4/5/09

Contents

Animation of result versus time

Below is an animation showing how the results versus the execution times evolved over the contest. The points on the scatterplot are colorcoded by day of submission. The x-axis is a log plot to better show the spread of results. Getting MATLAB to show this movie required embedding special html code into the file, which should work with most any modern browser.

Load contest data

Load the contest data and map all the fields we need for the visualization

load contest_data
passed=[d.passed];
result=[d.result];
timestamp=[d.timestamp];
cpu_time=[d.cpu_time];
numentries=size(passed,2);
startdate=str2num(datestr(timestamp(1),'dd'));

Setup figure parameters

Sets up the figure and axes to sizes good for the animation

figure('Position',[100 100 600 600]);
axes('Position',[100/600 100/600 350/600 350/600],'XScale','log', 'Color', [.8 .8 .8]);
axis([35000 250000 0 180]);
hold on
colspec='ymcrgbkw';

Create frames

Plot in sequence all the passing entries on a scatter plot. To make the movie not too long only grab every 10th frame or so. Also change the color of the scatter plot point based upon what day it is.

k=1;
for x=1:numentries
    if passed(x)
        colspecind=str2num(datestr(timestamp(x),'dd'))-startdate+1;
        scatter(result(x),cpu_time(x),3,colspec(colspecind), 'filled');
        if rem(x,10)==0
            M(k)=getframe(gcf,[75 75 400 400]);
            k=k+1;
        end
    end
end

Create .avi file

Convert the movie to an avi

cd('html');
movie2avi(M,'dataviz.avi', 'fps', 5, 'compression', 'None');
cd('..');

Contact us