-
Notifications
You must be signed in to change notification settings - Fork 0
/
cartoonFigure.m
221 lines (171 loc) · 5.61 KB
/
cartoonFigure.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
figDir = 'tex/figs_src';
mkdir(figDir);
saveResults = false;
useFigureComposer = true;
if(useFigureComposer)
addpath ~/FigureComposer/matlab %saves our figures using FigureComposer/DataNav format
end
% stimPoints = [1 5;
% 8 -2;
% -3 -6];
stimPoints = [0 4;
0 0;
0 -4];
stimPoints(:,1) = 1;
theta =-20;
Mr = [cosd(theta) sind(theta); -sind(theta) cosd(theta)];
stimPoints = (Mr*stimPoints')';
stimPoints = stimPoints-mean(stimPoints,1);
timePoints = [-4 0;
-2 0;
0 0;
2 0;
4 0];
timePoints(:,2) = 0;
timePoints = timePoints-mean(timePoints,1);
rng(12122018);
NN = randn(15,2,2)*0.25;
% NN(1:5,:,2) = [-5 0;
% -3 0;
% 0 0;
% 3 0;
% 5 0];
% NN(6:10,:,2) = [1 -6;
% 0.5 -3;
% 0 0;
% -0.5 3;
% -1 6];0
% NN(11:15,:,2) = [-0.5 2;
% -0.25 1;
% 0 0;
% 0.25 -1;
% 0.5 -2];
NN(1:5 ,:,2) = [-2 -3;
-1 -1.5;
0 0;
1 1.5;
2 3];
NN(11:15 ,:,2) = [ 2 2;
1 1;
0 0 ;
-1 -1;
-2 -2];
NN(6:10 ,:,2) = -(NN(1:5 ,:,2) + NN(11:15,:,2));
% NN(1:5,:,2) = -[5 -5;
% 3 -3;
% 0 0;
% -3 3;
% -5 5];
% NN(6:10,1,2) = -NN(1:5,1,2);
% NN(6:10,2,2) = -NN(1:5,2,2);
% NN(11:15,:,2) = [0 0;
% 0 0;
% 0 0;
% 0.0 0;
% 0.0 0];
ccs = [1 0 0;
0 1 0;
0 0 1];
ms = 5;
lw = 1.5;
lw2 = 1;
fontSize_axis = 10;
fontSize_label = 12;
fontSize_title = 12;
NR = 4;
NC = 4;
figure(1);
clf
for ff = 1:2
subplot(NR,NC,1+(ff-1)*NC*2)
hold on
for ii = 1:3
plot(stimPoints(ii,1),stimPoints(ii,2),'o','MarkerFaceColor',ccs(ii,:),'Color',ccs(ii,:),'MarkerSize',ms);
end
set(gca,'TickDir','out','box','off','FontSize',fontSize_axis);
xlim([-10 10]);
ylim([-10 10]);
xlabel('latent dim. 1','FontSize',fontSize_label);
ylabel('latent dim. 2','FontSize',fontSize_label);
title('stimulus component','fontSize',fontSize_title);
axis square
hold off
subplot(NR,NC,2+(ff-1)*NC*2)
hold on
plot(timePoints(:,1),timePoints(:,2),'o-','MarkerFaceColor',[0.7 0.7 0.7],'Color',[0.7 0.7 0.7],'MarkerSize',ms);
plot(timePoints(1,1),timePoints(1,2),'o-','Color',[0.7 0.7 0.7]*0,'MarkerSize',ms);
set(gca,'TickDir','out','box','off','FontSize',fontSize_axis);
xlim([-10 10]);
ylim([-10 10]);
xlabel('latent dim. 1','FontSize',fontSize_label);
ylabel('latent dim. 2','FontSize',fontSize_label);
title('time component','fontSize',fontSize_title);
axis square
hold off
subplot(NR,NC,3+(ff-1)*NC*2);
hold on
for ii = 1:3
tts = (1:5) + (ii-1)*5;
plot(NN(tts,1,ff),NN(tts,2,ff),'o-','MarkerFaceColor',ccs(ii,:),'Color',ccs(ii,:),'MarkerSize',ms);
plot(NN(tts(1),1,ff),NN(tts(1),2,ff),'o-','MarkerFaceColor',ccs(ii,:),'Color',[0 0 0],'MarkerSize',ms);
end
set(gca,'TickDir','out','box','off','FontSize',fontSize_axis);
xlim([-10 10]);
ylim([-10 10]);
xlabel('latent dim. 1','FontSize',fontSize_label);
ylabel('latent dim. 2','FontSize',fontSize_label);
title('interaction','fontSize',fontSize_title);
axis square
hold off
subplot(NR,NC,4+(ff-1)*NC*2)
hold on
pps = nan(5,2,3);
for ii = 1:3
tts = (1:5) + (ii-1)*5;
timePoints_c = timePoints;
pps(:,:,ii) = [NN(tts,1,ff)+stimPoints(ii,1) + timePoints_c(:,1), NN(tts,2,ff)+stimPoints(ii,2) + timePoints_c(:,2)];
plot(pps(:,1,ii),pps(:,2,ii),'o-','MarkerFaceColor',ccs(ii,:),'Color',ccs(ii,:),'MarkerSize',ms);
plot(pps(1,1,ii),pps(1,2,ii),'o-','MarkerFaceColor',ccs(ii,:),'Color',[0 0 0],'MarkerSize',ms);
end
set(gca,'TickDir','out','box','off','FontSize',fontSize_axis);
xlim([-10 10]);
ylim([-10 10]);
xlabel('latent dim. 1','FontSize',fontSize_label);
ylabel('latent dim. 2','FontSize',fontSize_label);
title('total','fontSize',fontSize_title);
axis square
hold off
subplot(NR,NC,5+(ff-1)*NC*2)
hold on
for ii = 1:3
plot(mean(pps(:,1,ii)),mean(pps(:,2,ii)),'o','MarkerFaceColor',ccs(ii,:),'Color',ccs(ii,:),'MarkerSize',ms);
end
set(gca,'TickDir','out','box','off','FontSize',fontSize_axis);
xlim([-10 10]);
ylim([-10 10]);
xlabel('latent dim. 1','FontSize',fontSize_label);
ylabel('latent dim. 2','FontSize',fontSize_label);
title('stimulus mean','fontSize',fontSize_title);
axis square
hold off
subplot(NR,NC,6+(ff-1)*NC*2)
hold on
plot(mean(pps(:,1,:),3),mean(pps(:,2,:),3),'o-','MarkerFaceColor',[0.7 0.7 0.7],'Color',[0.7 0.7 0.7],'MarkerSize',ms);
set(gca,'TickDir','out','box','off','FontSize',fontSize_axis);
xlim([-10 10]);
ylim([-10 10]);
xlabel('latent dim. 1','FontSize',fontSize_label);
ylabel('latent dim. 2','FontSize',fontSize_label);
title('time mean','fontSize',fontSize_title);
axis square
hold off
end
plotSize = 2;
set(gcf,'PaperSize',[NC NR]*plotSize,'PaperPosition',[0 0 NC NR]*plotSize);
if(saveResults)
if(useFigureComposer)
matfig2fyp(gcf,sprintf('%s/cartoon_rough.fyp',figDir));
else
saveas(gcf,sprintf('%s/cartoon_rough.eps',figDir),'epsc');
end
end