-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualp.m
49 lines (36 loc) · 1.27 KB
/
visualp.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function [] = visualp( arg )
h=0:0.5:10;
%{
figure;
data1 = arg.pol(:,1:length(h));
data2 = arg.pol(:,length(h)+1:end);
%boxplot(data1,h, 'colors', 'k'); hold on;
%boxplot(data2,h, 'colors', 'b'); hold on;
dat = {data1, data2};
%aboxplot(dat,'labels', (0:0.5:10),'Colormap', [1 0 0; 0 0 1], 'WidthL', 0.7); hold on;
g1 = plot(h, mean(data1),'r', 'LineWidth',4);
hold on;
g2 = plot(h, mean(data2), 'LineWidth',4);
set(g2, 'Color', [0 0.5 1]);
xlabel('homophily h');
ylabel('average polarization');
legend('rejection model: agents: 100, a: 1.5', 'persuasion model');
%}
figure;
for i = 1:length(arg.pol(1,1,:))
data1 = arg.pol(:,1:length(h),i);
data2 = arg.pol(:,length(h)+1:end,i);
subplot(2,2,i);
%title([num2str(arg.agents(i)) ' agents'] );
g1 = plot(h, mean(data1),'r', 'LineWidth',4);
hold on;
title([num2str(arg.agents(i)) ' agents'] );
g2 = plot(h, mean(data2), 'LineWidth',4);
axis([0 10 0 1]);
legend('rejection', 'persuasion');
ylabel('average polarization');
xlabel('homophily h');
hold off;
set(g2, 'Color', [0 0.5 1]);
end
end