-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
512 lines (512 loc) · 19.3 KB
/
.Rhistory
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
sum((test - Xtest[, 4])^2)
sum((test - Xtest[, 4])^2)/15
head(X)
#construct a tridiagonal matrix
tridiagonal = function(size, entries=1){
A = matrix(0, size, size)
for (i in 1:(size-1)) {A[i,i+1] = entries}
for (i in 1:(size-1)) {A[i+1,i] = entries}
A
}
#ellipse
E = 1
theta <- seq(0, 2 * pi, length=100)
ellipseX <- E + 10*cos(theta)
ellipseY <- 0.05 * sin(theta)
dimension = 1000
sigma =0.5
A = tridiagonal(dimension)
diag(A) = rnorm(n=dimension, sd = sigma)
V = eigen(A)
y = V$vectors[,711]
d = data.frame(cbind(dimension*V$values, 0))
names(d) = c('evalues', 'y')
p = ggplot(data = d, aes(x= evalues, y = y))
library('ggplot2')
p = ggplot(data = d, aes(x= evalues, y = y))
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue') +
xlim(c(-10,11)) + ylim(c(-0.1,0.1))
ellipseX <- E + 50*cos(theta)
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue') +
xlim(c(-100,101)) + ylim(c(-0.1,0.1))
p + geom_point(colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue') +
xlim(c(-100,101)) + ylim(c(-0.1,0.1))
ellipseX <- E + (1/1000)*cos(theta)
p + geom_point(colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue') +
xlim(c(-100,101)) + ylim(c(-0.1,0.1))
dimension = 1000
sigma = 1/sqrt(dimension)
A = tridiagonal(dimension)
diag(A) = rnorm(n=dimension, sd = sigma)
V = eigen(A)
y = V$vectors[,711]
d = data.frame(cbind(dimension*V$values, 0))
names(d) = c('evalues', 'y')
p = ggplot(data = d, aes(x= evalues, y = y))
p + geom_point(colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue') +
xlim(c(-100,101)) + ylim(c(-0.1,0.1))
A
A[1,1]
A[1,2]
head(V$values)
head(V$values,20)
tail(V$values,20)
d = data.frame(cbind(V$values, 0))
names(d) = c('evalues', 'y')
p = ggplot(data = d, aes(x= evalues, y = y))
p + geom_point(colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue') +
xlim(c(-100,101)) + ylim(c(-0.1,0.1))
p + geom_point(colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue')
ellipseX <- E + (1/10)*cos(theta)
p + geom_point(colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue')
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue')
p + geom_point(colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue')
xlim(c(-1,1)) + ylim(c(-0.1,0.1))
p + geom_point(colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue')
p + geom_point(colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue') +
xlim(c(-1,1)) + ylim(c(-0.1,0.1))
p + geom_point(colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue') +
xlim(c(0.5,1.5)) + ylim(c(-0.1,0.1))
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue') +
xlim(c(0.5,1.5)) + ylim(c(-0.1,0.1))
ellipseY <- 0.025 * sin(theta)
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue') +
xlim(c(0.75,1.25)) + ylim(c(-0.1,0.1)) + ylabel("")
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=ellipseX, y= ellipseY), colour = 'blue') +
xlim(c(0.75,1.25)) + ylim(c(-0.1,0.1)) + ylab("")
ellipse = function(centre = c(0,0),
majorAxis = 1, minorAxis =1){
theta <- seq(0, 2 * pi, length=100)
ellipseX <- centre[2] + majorAxis*cos(theta)
ellipseY <- centre[2] * minorAxis*sin(theta)
list(x = ellipseX, y = ellipseY)
}
l = ellipse()
plot(l$x, l$y)
ellipse = function(centre = c(0,0),
majorAxis = 1, minorAxis =1){
theta <- seq(0, 2 * pi, length=100)
ellipseX <- centre[1] + majorAxis*cos(theta)
ellipseY <- centre[2] * minorAxis*sin(theta)
list(x = ellipseX, y = ellipseY)
}
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=ellipse()$x, y= ellipse()$y), colour = 'blue') +
xlim(c(0.75,1.25)) + ylim(c(-0.1,0.1)) + ylab("")
el = ellipse()
head(el)
ellipse = function(centre = c(0,0),
majorAxis = 1, minorAxis =1){
theta <- seq(0, 2 * pi, length=100)
ellipseX <- centre[1] + majorAxis*cos(theta)
ellipseY <- centre[2] + minorAxis*sin(theta)
list(x = ellipseX, y = ellipseY)
}
plot(l$x, l$y)
l = ellipse()
plot(l$x, l$y)
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=ellipse()$x, y= ellipse()$y), colour = 'blue') +
xlim(c(0.75,1.25)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=ellipse()$x, y= ellipse()$y), colour = 'blue')# +
?rect
?rect
?rev
rec(c(-1,2,1))
rev(c(-1,2,1))
rectangle = function(xleft, ybottom, xright, ytop){
l = 100*max(xright - xleft, ytop - ybottom)
x = seq(xleft, xright, length = l)
y = seq(ybottom, ytop, length = l)
rbind(cbind(xleft,y), cbind(x, ytop),
cbind(xright, rev(y)), cbind(rev(x), ybottom)
}
rectangle = function(xleft, ybottom, xright, ytop){
l = 100*max(xright - xleft, ytop - ybottom)
x = seq(xleft, xright, length = l)
y = seq(ybottom, ytop, length = l)
rbind(cbind(xleft,y), cbind(x, ytop),
cbind(xright, rev(y)), cbind(rev(x), ybottom))
}
r = rectangle(0,0,1,1)
head(r[[1]])
head(r[[1]],20)
head(r,20)
r[[1]]
r[1,]
str(r)
rectangle = function(xleft, ybottom, xright, ytop){
l = 100*max(xright - xleft, ytop - ybottom)
x = seq(xleft, xright, length = l)
y = seq(ybottom, ytop, length = l)
r = rbind(cbind(xleft,y), cbind(x, ytop),
cbind(xright, rev(y)), cbind(rev(x), ybottom))
names(r) = c("x", "y")
}
r = rectangle(0,0,1,1)
str(r)
rectangle = function(xleft, ybottom, xright, ytop){
l = 100*max(xright - xleft, ytop - ybottom)
x = seq(xleft, xright, length = l)
y = seq(ybottom, ytop, length = l)
r = rbind(cbind(xleft,y), cbind(x, ytop),
cbind(xright, rev(y)), cbind(rev(x), ybottom))
names(r) = c("x", "y")
r
}
r = rectangle(0,0,1,1)
str(r)
head(r)
class(r)
colnames(r)
rectangle = function(xleft, ybottom, xright, ytop){
l = 100*max(xright - xleft, ytop - ybottom)
x = seq(xleft, xright, length = l)
y = seq(ybottom, ytop, length = l)
r = rbind(cbind(xleft,y), cbind(x, ytop),
cbind(xright, rev(y)), cbind(rev(x), ybottom))
colnames(r) = c("x", "y")
r
}
r = rectangle(0,0,1,1)
str(r)
plot(r[,1], r[,2])
E = 1
epsilon = 0.1
r = rect(xleft = E-epsilon, ybottom = -0.1,
xright = E + epsilon, ytop = 0.1)
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=r[,1], y= r[,2]), colour = 'blue')# +
xlim(c(0.75,1.25)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=r[,1], y= r[,2]), colour = 'blue') # +
r
r = rect(xleft = E-epsilon, ybottom = -0.1,
xright = E + epsilon, ytop = 0.1)
r
r = rectangle(xleft = E-epsilon, ybottom = -0.1,
xright = E + epsilon, ytop = 0.1)
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=r[,1], y= r[,2]), colour = 'blue') # +
r
ggplot() + geom_path(aes(x=r[,1], y= r[,2]), colour = 'blue')
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=r[,1], y= r[,2]), colour = 'blue')
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(x=r[,1], y= r[,2]), colour = 'blue') +
xlim(c(0.75,1.25)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(r[,1], r[,2]), colour = 'blue') +
xlim(c(0.75,1.25)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(shape = 3, colour = 'red') +
geom_path(aes(r[,1], r[,2]), colour = 'blue')
p + geom_point(shape = 3, colour = 'red') +
geom_path(x = r[,1], y =r[,2], colour = 'blue')
p + geom_point(shape = 3, colour = 'red') +
geom_path(x = r[,1], y =r[,2])
r = data.frame(rectangle(xleft = E-epsilon, ybottom = -0.1,
xright = E + epsilon, ytop = 0.1))
p + geom_point(shape = 3, colour = 'red') +
geom_path(data = r, x = x, y = y)
p + geom_point(shape = 3, colour = 'red') +
geom_path(data = r, aes(x = x, y = y))
r = data.frame(rectangle(xleft = E-epsilon, ybottom = -0.01,
xright = E + epsilon, ytop = 0.01))
p + geom_point(shape = 3, colour = 'red') +
geom_path(data = r, aes(x = x, y = y))
p + geom_point(shape = 3, colour = 'red') +
geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.75,1.25)) + ylim(c(-0.1,0.1)) + ylab("")
quartz()
p + geom_point(shape = 3, colour = 'red') +
geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.9,1.1)) + ylim(c(-0.1,0.1)) + ylab("")
ggplot + geom_hline(data = c(0,1))
ggplot + geom_hline(c(0,1))
ggplot + geom_hline(aes(c(0,1)))
ggplot + geom_hline(aes(x = c(0,1)))
p + annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.2,"cm")))
install.packages('grid')
library(grid)
p + annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.2,"cm")))
p = ggplot(data = d, aes(x= evalues, y = y))
p + annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.2,"cm")))
d = data.frame(cbind(V$values, 0))
names(d) = c('evalues', 'y')
p = ggplot(data = d, aes(x= evalues, y = y))
p + geom_point()
p + geom_point(shape = 3, colour = 'red') +
annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.2,"cm"))) +
geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.9,1.1)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(shape = 3, colour = 'red') +
annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.2,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.9,1.1)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(shape = 3, colour = 'red') +
annotate("segment", x=0.9, xend=1.1, y=-.025, yend=-.025,
arrow=arrow(ends="both", angle=90, length=unit(.2,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.9,1.1)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(shape = 3, colour = 'red') +
annotate("segment", x=0.9, xend=1.1, y=-.025, yend=-.025,
arrow=arrow(ends="both", angle=90, length=unit(.2,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.8,1.2)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(shape = 3, colour = 'red') +
annotate("segment", x=0.9, xend=1.1, y=-.025, yend=-.025,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.8,1.2)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(shape = 3, colour = 'red') +
annotate("segment", x=0.9, xend=1.1, y=0, yend=0,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(shape = 3, colour = 'red') +
annotate("segment", x=0.9, xend=1.1, y=0.01, yend=0.00,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(shape = 3, colour = 'red') +
annotate("segment", x=0.9, xend=1.1, y=0.01, yend=0.01,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(shape = 3, colour = 'red') +
annotate("segment", x=0.9, xend=1.1, y=0.0, yend=0.0,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(colour = 'red') +
annotate("segment", x=0.9, xend=1.1, y=0.0, yend=0.0,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(colour = 'red', length = unit(0.1, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.0, yend=0.0,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(colour = 'red', length = unit(0.01, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.0, yend=0.0,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(colour = 'red', length = unit(0.001, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.0, yend=0.0,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(colour = 'red', length = unit(0.0001, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.0, yend=0.0,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.1,0.1)) + ylab("")
p + geom_point(colour = 'red', length = unit(0.0001, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.0, yend=0.0,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-1,1)) + ylab("")
p + geom_point(colour = 'red', length = unit(0.0001, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.1, yend=0.1,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-1,1)) + ylab("")
p + geom_point(colour = 'red', length = unit(0.0001, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.1, yend=0.1,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.01,1)) + ylab("")
p + geom_point(colour = 'red', length = unit(0.0001, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.1, yend=0.01,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.01,1)) + ylab("")
p + geom_point(colour = 'red', length = unit(0.0001, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.01, yend=0.01,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.01,1)) + ylab("")
p + geom_point(colour = 'red', length = unit(0.0001, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.05, yend=0.05,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
#geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.7,1.3)) + ylim(c(-0.01,1)) + ylab("")
p + geom_point(colour = 'red') +
geom_path(data = r, aes(x = x, y = y)) +
xlim(c(0.9,1.1)) + ylim(c(-0.01,1)) + ylab("")
p + geom_point(colour = 'red') +
xlim(c(0.9,1.1)) + ylim(c(-0.01,1)) + ylab("")
p + geom_point(colour = 'red', length = unit(0.0001, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.05, yend=0.05,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
xlim(c(0.7,1.3)) + ylim(c(-0.01,1)) + ylab("")
pdf('eigenvaluePP.pdf')
p + geom_point(colour = 'red', length = unit(0.0001, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.05, yend=0.05,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
xlim(c(0.7,1.3)) + ylim(c(-0.01,1)) + ylab("")
dev.off()
pdf('localEigenvaluePP.pdf')
p + geom_point(colour = 'red') +
xlim(c(0.9,1.1)) + ylim(c(-0.01,1)) + ylab("")
dev.off()
?grid
p + annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.3,"cm"))) +
theme(panel.grid.major = element_blank())
p + annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.3,"cm"))) +
theme(panel.grid.major = element_blank(),
panel.gril.minor = element_blank())
p + annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.3,"cm"))) +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank())
quartz()
p + annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.3,"cm"))) +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank())
p + annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.3,"cm"))) +
p + annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.3,"cm"))) +
theme(panel.grid.major = element_blank())
p + annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.3,"cm"))) +
theme(panel.grid.major = element_blank())
p + annotate("segment", x=0.9, xend=1.1, y=-.25, yend=-.25,
arrow=arrow(ends="both", angle=90, length=unit(.3,"cm")))
p + geom_point(colour = 'red', length = unit(0.0001, 'cm')) +
annotate("segment", x=0.9, xend=1.1, y=0.05, yend=0.05,
arrow=arrow(ends="both", angle=90, length=unit(.4,"cm"))) +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
xlim(c(0.7,1.3)) + ylim(c(-0.01,1)) + ylab("")
p2 = ggplot(aes(x= y), data = y)
p2 = ggplot(aes(x= y), data = data.frame(y))
p2 + geom_point()
d1 = data.frame(y)
d1
head(d1)
p2 = ggplot(aes(x = 1:length(y), x= y), data = data.frame(y))
p2 = ggplot(aes(x = 1:length(y), y=y), data = data.frame(y))
p2 + geom_point()
p2 + geom_path()
plotEigenvector = function(n){
y = V$vectors[,n]
ggplot(aes(x = 1:length(y), y=y), data = data.frame(y))
}
p2 = plotEigenvector(712)
p2 + geom_path()
p2 = plotEigenvector(812)
p2 + geom_path()
quartz()
source('~/.active-rstudio-document', echo=TRUE)
drawZxZ(20,20)
colorF = function(x){
if (x == 1){
return(x)}
else if (x == 3){
return(0}
colorF = function(x){
if(x==1){return(x)}
else {return(0)}
}
colorF(1)
colorF(3)
drawZxZ = function(length,width, potentialScale = 1, sinks = rnorm(length*width)){
c = Map(getIJ, z=1:(length*width), n=length, m=width)
c = Map(getXY, c, n=length, m=width)
c = matrix(unlist(c), ncol = 2, byrow=T)
A = matrix(0, nrow=(length*width), ncol=(length*width))
A = addAllNeighbours(A, n=length, m=width)
gplot(A, jitter=F, gmode = 'graph', coord = c,
vertex.col = colorF(sinks), vertex.cex = abs(sinks))
}
drawZxZ(20,20)
map(colorF, c(0,1,2))
Map(colorF, c(0,1,2))
drawZxZ = function(length,width, potentialScale = 1, sinks = rnorm(length*width)){
c = Map(getIJ, z=1:(length*width), n=length, m=width)
c = Map(getXY, c, n=length, m=width)
c = matrix(unlist(c), ncol = 2, byrow=T)
A = matrix(0, nrow=(length*width), ncol=(length*width))
A = addAllNeighbours(A, n=length, m=width)
gplot(A, jitter=F, gmode = 'graph', coord = c,
vertex.col = Map(colorF, sinks), vertex.cex = abs(sinks))
}
drawZxZ(20,20)
warnings()
sapply(c(0,1,0), sinks)
sapply(c(0,1,0), colorF)
drawZxZ = function(length,width, potentialScale = 1, sinks = rnorm(length*width)){
c = Map(getIJ, z=1:(length*width), n=length, m=width)
c = Map(getXY, c, n=length, m=width)
c = matrix(unlist(c), ncol = 2, byrow=T)
A = matrix(0, nrow=(length*width), ncol=(length*width))
A = addAllNeighbours(A, n=length, m=width)
gplot(A, jitter=F, gmode = 'graph', coord = c,
vertex.col = sapply(sinks, colorF), vertex.cex = abs(sinks))
}
sapply(c(0,1,0), colorF)
drawZxZ(20,20)
colorF = function(x){
if(x==1){return(x)}
else {return(2)}
}
drawZxZ = function(length,width, potentialScale = 1, sinks = rnorm(length*width)){
c = Map(getIJ, z=1:(length*width), n=length, m=width)
c = Map(getXY, c, n=length, m=width)
c = matrix(unlist(c), ncol = 2, byrow=T)
A = matrix(0, nrow=(length*width), ncol=(length*width))
A = addAllNeighbours(A, n=length, m=width)
gplot(A, jitter=F, gmode = 'graph', coord = c,
vertex.col = sapply(sinks, colorF), vertex.cex = abs(sinks))
}
drawZxZ(20,20)
sinks = rnorm(length*width)
sinks = rnorm(12)
sapply(sinks, colorF)
sapply(sign(sinks), colorF)
drawZxZ = function(length,width, potentialScale = 1, sinks = rnorm(length*width)){
c = Map(getIJ, z=1:(length*width), n=length, m=width)
c = Map(getXY, c, n=length, m=width)
c = matrix(unlist(c), ncol = 2, byrow=T)
A = matrix(0, nrow=(length*width), ncol=(length*width))
A = addAllNeighbours(A, n=length, m=width)
gplot(A, jitter=F, gmode = 'graph', coord = c,
vertex.col = sapply(sign(sinks), colorF), vertex.cex = abs(sinks))
}
drawZxZ(20,20)
setwd("~/Documents/2dGridPlots")
pdf("~/Documents/UtahPresentationRandomEigenvectors//GridPlots/2dPotential.pdf")
drawZxZ(20,20)
dev.close()
dev.close
dev.off()
pdf("~/Documents/UtahPresentationRandomEigenvectors//GridPlots/1dPotentialA.pdf")
drawZxZ(1,20)
dev.off()