-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiowa-corr-bach.m
30 lines (25 loc) · 1.02 KB
/
iowa-corr-bach.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
% Contains county data sorted by delegate difference
iowaData = csvread('iowa-data-sorted.csv');
numCounties = rows(iowaData) - 1;
numProperties = columns(iowaData) - 1;
% Exclude column headers and county names
iowaStats = iowaData(2:end, 2:end);
sandersCounties = 37;
tiedCounties = 3;
clintonCounties = numCounties - sandersCounties - tiedCounties;
X = iowaStats(:, 5);
Y = iowaStats(:, 11);
graphics_toolkit("gnuplot")
fig = figure;
hold on;
% Color Sanders counties blue, Clinton counties red, and tied counties black
plot(X(1:sandersCounties), Y(1:sandersCounties), 'b.')
plot(X(sandersCounties + 1:sandersCounties + tiedCounties),
Y(sandersCounties + 1:sandersCounties + tiedCounties), 'k.')
plot(X(numCounties - clintonCounties + 1:numCounties - 1),
Y(numCounties - clintonCounties + 1:numCounties - 1), 'r.')
title('Bachelors Degree Percentage and Delegate Difference')
xlabel('Bachelors Degree Percentage')
ylabel('Delegate Difference (Sanders Del. - Clinton Del.)')
hold off;
saveas(fig,'figures/iowa-corr-bach','pdf')