-
Notifications
You must be signed in to change notification settings - Fork 1
/
Drawing Boxplots.R
156 lines (135 loc) · 13.9 KB
/
Drawing Boxplots.R
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
#### visualizing changes in social rates pre and post hurricane
fudge <- .15
col1 <- "#356b86"; col2 <- "#f49634"
pdf(file="pNotAlone.pdf", width=3.75, height=4.25, onefile = T)
{
# Group V Stripcharts
# Post Hurricane
stripchart(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 1 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=F, at=1 + fudge)
stripchart(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 2 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=2 + fudge, axes=F)
stripchart(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 3 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=3 + fudge, axes=F)
stripchart(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 4 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=4 + fudge, axes=F)
# Pre Hurricane
stripchart(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 1 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=1 - fudge, axes=F)
stripchart(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 2 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=2 - fudge, axes=F)
stripchart(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 3 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=3 - fudge, axes=F)
stripchart(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 4 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=4 - fudge, axes=F)
# Group V boxplots
# Post Hurricane
boxplot(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 1 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=1 + fudge, axes=F)
boxplot(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 2 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=2 + fudge, axes=F)
boxplot(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 3 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=3 + fudge, axes=F)
boxplot(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 4 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=4 + fudge, axes=F)
# Pre Hurricane
boxplot(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 1 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=1 - fudge, axes=F)
boxplot(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 2 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=2 - fudge, axes=F)
boxplot(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 3 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=3 - fudge, axes=F)
boxplot(A3$pNotAlone[A3$group=="groupKK" & A3$Q == 4 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=4 - fudge, axes=F)
} # Group KK Boxplots
{
# Group V Stripcharts
# Post Hurricane
stripchart(A3$pNotAlone[A3$group=="groupV" & A3$Q == 1 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=F, at=1 + fudge)
stripchart(A3$pNotAlone[A3$group=="groupV" & A3$Q == 2 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=2 + fudge, axes=F)
stripchart(A3$pNotAlone[A3$group=="groupV" & A3$Q == 3 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=3 + fudge, axes=F)
stripchart(A3$pNotAlone[A3$group=="groupV" & A3$Q == 4 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=4 + fudge, axes=F)
# Pre Hurricane
stripchart(A3$pNotAlone[A3$group=="groupV" & A3$Q == 1 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=1 - fudge, axes=F)
stripchart(A3$pNotAlone[A3$group=="groupV" & A3$Q == 2 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=2 - fudge, axes=F)
stripchart(A3$pNotAlone[A3$group=="groupV" & A3$Q == 3 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=3 - fudge, axes=F)
stripchart(A3$pNotAlone[A3$group=="groupV" & A3$Q == 4 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=4 - fudge, axes=F)
# Group V boxplots
# Post Hurricane
boxplot(A3$pNotAlone[A3$group=="groupV" & A3$Q == 1 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=1 + fudge, axes=F)
boxplot(A3$pNotAlone[A3$group=="groupV" & A3$Q == 2 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=2 + fudge, axes=F)
boxplot(A3$pNotAlone[A3$group=="groupV" & A3$Q == 3 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=3 + fudge, axes=F)
boxplot(A3$pNotAlone[A3$group=="groupV" & A3$Q == 4 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=4 + fudge, axes=F)
# Pre Hurricane
boxplot(A3$pNotAlone[A3$group=="groupV" & A3$Q == 1 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=1 - fudge, axes=F)
boxplot(A3$pNotAlone[A3$group=="groupV" & A3$Q == 2 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=2 - fudge, axes=F)
boxplot(A3$pNotAlone[A3$group=="groupV" & A3$Q == 3 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=3 - fudge, axes=F)
boxplot(A3$pNotAlone[A3$group=="groupV" & A3$Q == 4 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=4 - fudge, axes=F)
} # Group V Boxplots
dev.off(); browseURL("pNotAlone.pdf")
pdf(file="pSocial.pdf", width=3.75, height=4.25, onefile = T)
{
# Group V Stripcharts
# Post Hurricane
stripchart(A3$pSocial[A3$group=="groupKK" & A3$Q == 1 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,.3), add=F, at=1 + fudge)
stripchart(A3$pSocial[A3$group=="groupKK" & A3$Q == 2 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,.3), add=T, at=2 + fudge, axes=F)
stripchart(A3$pSocial[A3$group=="groupKK" & A3$Q == 3 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,.3), add=T, at=3 + fudge, axes=F)
stripchart(A3$pSocial[A3$group=="groupKK" & A3$Q == 4 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,.3), add=T, at=4 + fudge, axes=F)
# Pre Hurricane
stripchart(A3$pSocial[A3$group=="groupKK" & A3$Q == 1 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,.3), add=T, at=1 - fudge, axes=F)
stripchart(A3$pSocial[A3$group=="groupKK" & A3$Q == 2 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,.3), add=T, at=2 - fudge, axes=F)
stripchart(A3$pSocial[A3$group=="groupKK" & A3$Q == 3 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,.3), add=T, at=3 - fudge, axes=F)
stripchart(A3$pSocial[A3$group=="groupKK" & A3$Q == 4 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,.3), add=T, at=4 - fudge, axes=F)
# Group V boxplots
# Post Hurricane
boxplot(A3$pSocial[A3$group=="groupKK" & A3$Q == 1 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=1 + fudge, axes=F)
boxplot(A3$pSocial[A3$group=="groupKK" & A3$Q == 2 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=2 + fudge, axes=F)
boxplot(A3$pSocial[A3$group=="groupKK" & A3$Q == 3 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=3 + fudge, axes=F)
boxplot(A3$pSocial[A3$group=="groupKK" & A3$Q == 4 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=4 + fudge, axes=F)
# Pre Hurricane
boxplot(A3$pSocial[A3$group=="groupKK" & A3$Q == 1 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=1 - fudge, axes=F)
boxplot(A3$pSocial[A3$group=="groupKK" & A3$Q == 2 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=2 - fudge, axes=F)
boxplot(A3$pSocial[A3$group=="groupKK" & A3$Q == 3 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=3 - fudge, axes=F)
boxplot(A3$pSocial[A3$group=="groupKK" & A3$Q == 4 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=4 - fudge, axes=F)
} # Group KK Boxplots
{
# Group V Stripcharts
# Post Hurricane
stripchart(A3$pSocial[A3$group=="groupV" & A3$Q == 1 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,.3), add=F, at=1 + fudge)
stripchart(A3$pSocial[A3$group=="groupV" & A3$Q == 2 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=2 + fudge, axes=F)
stripchart(A3$pSocial[A3$group=="groupV" & A3$Q == 3 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=3 + fudge, axes=F)
stripchart(A3$pSocial[A3$group=="groupV" & A3$Q == 4 & A3$isPost == 1], col=adjustcolor(col1, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=4 + fudge, axes=F)
# Pre Hurricane
stripchart(A3$pSocial[A3$group=="groupV" & A3$Q == 1 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=1 - fudge, axes=F)
stripchart(A3$pSocial[A3$group=="groupV" & A3$Q == 2 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=2 - fudge, axes=F)
stripchart(A3$pSocial[A3$group=="groupV" & A3$Q == 3 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=3 - fudge, axes=F)
stripchart(A3$pSocial[A3$group=="groupV" & A3$Q == 4 & A3$isPost == 0], col=adjustcolor( col2, .075), method= "jitter", jitter= .15, vertical =T,
xlim=c(0,5), pch = 19, ylim=c(0,1), add=T, at=4 - fudge, axes=F)
# Group V boxplots
# Post Hurricane
boxplot(A3$pSocial[A3$group=="groupV" & A3$Q == 1 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=1 + fudge, axes=F)
boxplot(A3$pSocial[A3$group=="groupV" & A3$Q == 2 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=2 + fudge, axes=F)
boxplot(A3$pSocial[A3$group=="groupV" & A3$Q == 3 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=3 + fudge, axes=F)
boxplot(A3$pSocial[A3$group=="groupV" & A3$Q == 4 & A3$isPost == 1], col=adjustcolor(col1, .75), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=4 + fudge, axes=F)
# Pre Hurricane
boxplot(A3$pSocial[A3$group=="groupV" & A3$Q == 1 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=1 - fudge, axes=F)
boxplot(A3$pSocial[A3$group=="groupV" & A3$Q == 2 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=2 - fudge, axes=F)
boxplot(A3$pSocial[A3$group=="groupV" & A3$Q == 3 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=3 - fudge, axes=F)
boxplot(A3$pSocial[A3$group=="groupV" & A3$Q == 4 & A3$isPost == 0], col=adjustcolor( col2, .8), outline=F, xlim=c(0,5), ylim=c(0,1), add=T, at=4 - fudge, axes=F)
} # Group V Boxplots
dev.off(); browseURL("pSocial.pdf")