States = textread('statenames.txt', '%s');
fid = fopen('secyofstate.txt');
Secy = fscanf(fid, '%d', 50);

fid = fopen('line-mccain-pop.txt');
Data = fscanf(fid, '%g%g%g', [3,50]);
Data = 100* Data;
hold on
% plot(Data(2,:), Data(1,:), 'x')
for (i=1:50)
    if (Secy(i)==0)   
        text(Data(2,i)+.1, Data(1,i), States(i), 'color', [0 0 1], 'fontname', 'lucida', 'horizontalalignment', 'center')
    end
    if (Secy(i)==1)   
        text(Data(2,i)+.1, Data(1,i), States(i), 'color', [1 0 0], 'fontname', 'lucida', 'horizontalalignment', 'center')
    end
end
axis([0, 15, -20, 20])
fit = polyfit(Data(1,:), Data(2,:), 1)
linex = [2, 13];
% line(linex, fit(1)*linex+fit(2))

ylabel('% McCain outperforms pre-election polls','FontSize',16)
xlabel('% of 11/4 news articles including "long lines"','FontSize',16)
title('State by state: McCain advantage from long lines?','FontSize',16)

