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

fid = fopen('line-black-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 0], 'fontname', 'lucida', 'horizontalalignment', 'center')
    end
    if (Secy(i)==1)   
        text(Data(2,i)+.1, Data(1,i), States(i), 'color', [0 0 0], 'fontname', 'lucida', 'horizontalalignment', 'center')
    end
end

text(22, 2, 'Graph & data by Michael Peshkin', 'fontname', 'lucida');
text(22, 1.5, 'peshkin@northwestern.edu', 'fontname', 'lucida');
text(22, 1, 'source data at votebackhome.com/longlines', 'fontname', 'lucida');
text(22, 0.5, '2008-11-13', 'fontname', 'lucida');

axis([0, 40, 0, 15])
fit = polyfit(Data(2,:), Data(1,:), 1);
linex = [2, 38];
line(linex, fit(1)*linex+fit(2))

xlabel('State population % African-American','FontSize',15)
ylabel('11/4/2008 news articles including "long lines" (%)','FontSize',15)
title('The New Poll Tax: long lines at polling places (by state)','FontSize',16)