5 stability <- read.csv("stability.csv", stringsAsFactors = FALSE)
7 d <- stability[stability$time > '2010-07' & stability$time < '2011-07', ]
8 d <- d[, c("time", "running")]
10 d_mean <- aggregate(list(running = d$running),
11 by = list(date = as.Date(d$time)), quantile, probs = 0.5)
12 d_max <- aggregate(list(running = d$running),
13 by = list(date = as.Date(d$time)), quantile, probs = 0.75)
14 d_min <- aggregate(list(running = d$running),
15 by = list(date = as.Date(d$time)), quantile, probs = 0.25)
16 d <- data.frame(x = d_mean$date, y = d_mean$running, ymin = d_min$running,
19 data.frame(x = as.Date(setdiff(seq(from = min(d$x, na.rm = TRUE),
20 to = max(d$x, na.rm = TRUE), by="1 day"), d$x), origin = "1970-01-01"),
21 y = NA, ymin = NA, ymax = NA))
22 ggplot(d, aes(x = as.Date(x), y = y, ymin = ymin, ymax = ymax)) +
24 scale_x_date("", breaks = "3 months", minor_breaks = "1 month",
25 labels = date_format("%b %Y")) +
26 scale_y_continuous(name = "Running \nbridges ",
27 limits = c(0, max(d_mean$running, na.rm = TRUE))) +
28 opts(axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
30 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
32 ggsave(filename = "runningbridge.pdf", width = 7, height = 3, dpi = 100)
34 pdf("runningbridge-detail.pdf", width = 7, height = 4)
36 pushViewport(viewport(layout = grid.layout(2, 1)))
37 d <- stability[stability$time > '2010-07-10' &
38 stability$time < '2010-07-31', ]
39 a <- ggplot(d, aes(x = as.POSIXct(time), y = running)) +
40 geom_point(size = 0.75) +
41 scale_x_datetime(name = "", breaks = "1 week", minor_breaks = "1 day",
42 labels = date_format("%b %d, %Y")) +
43 scale_y_continuous(name = "Running \nbridges ",
44 limits = c(0, max(d$running, na.rm = TRUE))) +
45 opts(axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
47 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
49 legend.position = "none")
50 d <- stability[stability$time > '2011-01-24' &
51 stability$time < '2011-02-19', ]
52 e <- read.csv("stale-bridge-tarballs.csv", stringsAsFactors = FALSE,
53 col.names = c("time"))
55 data.frame(time = d$time, running = d$running, colour = "black"),
56 data.frame(time = e$time, running = 687, colour = "grey"))
57 b <- ggplot(d, aes(x = as.POSIXct(time), y = running, colour = colour)) +
58 geom_point(size = 0.75) +
59 scale_x_datetime(name = "", breaks = "1 week", minor_breaks = "1 day",
60 labels = date_format("%b %d, %Y")) +
61 scale_y_continuous(name = "Running \nbridges ",
62 limits = c(0, max(d$running, na.rm = TRUE))) +
63 scale_colour_manual(values = c("black", "grey60")) +
64 opts(axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
66 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
68 legend.position = "none")
69 print(a, vp = viewport(layout.pos.row = 1, layout.pos.col = 1))
70 print(b, vp = viewport(layout.pos.row = 2, layout.pos.col = 1))
73 d <- stability[stability$time > '2010-07' & stability$time < '2011-07', ]
74 d <- d[, c("time", "minwmtbaca50wmtbac", "minwta", "minwfua50wfu")]
76 d_mean <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
77 quantile, probs = 0.5)
78 d_max <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
79 quantile, probs = 0.75)
80 d_min <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
81 quantile, probs = 0.25)
83 data.frame(x = d_mean$date,
84 y = d_mean$minwmtbaca50wmtbac / (24 * 60 * 60),
85 ymin = d_min$minwmtbaca50wmtbac / (24 * 60 * 60),
86 ymax = d_max$minwmtbaca50wmtbac / (24 * 60 * 60),
87 var = "Median WMTBAC"),
88 data.frame(x = d_mean$date, y = d_mean$minwta / (24 * 60 * 60),
89 ymin = d_min$minwta / (24 * 60 * 60),
90 ymax = d_max$minwta / (24 * 60 * 60),
91 var = "12.5th perc. WT"),
92 data.frame(x = d_mean$date, y = d_mean$minwfua50wfu / 10000,
93 ymin = d_min$minwfua50wfu / 10000,
94 ymax = d_max$minwfua50wfu / 10000,
96 missing_dates <- as.Date(setdiff(seq(from = min(d$x, na.rm = TRUE),
97 to = max(d$x, na.rm = TRUE), by="1 day"), d$x), origin = "1970-01-01")
99 data.frame(x = missing_dates, y = NA, ymin = NA, ymax = NA,
100 var = "Median WMTBAC"),
101 data.frame(x = missing_dates, y = NA, ymin = NA, ymax = NA,
102 var = "12.5th perc. WT"),
103 data.frame(x = missing_dates, y = NA, ymin = NA, ymax = NA,
106 yintercept = c(30, 8, 0.98),
107 var = c("Median WMTBAC", "12.5th perc. WT", "Median WFU"))
108 ggplot(d, aes(x = as.Date(x), y = y, ymin = ymin, ymax = ymax)) +
109 geom_line() +#colour = "grey30") +
110 #geom_ribbon(alpha = 0.3) +
111 geom_hline(data = e, aes(yintercept = yintercept), colour = "gray40",
113 facet_grid(var ~ ., scales = "free_y") +
114 scale_x_date("", breaks = "3 months", minor_breaks = "1 month",
115 labels = date_format("%b %Y")) +
116 scale_y_continuous(name = "") +
117 opts(axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
119 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
121 ggsave(filename = "requirements.pdf", width = 7, height = 5, dpi = 100)
123 d <- stability[stability$time > '2010-07' & stability$time < '2011-07', ]
124 d <- d[, c("time", "perc10wfu0wfu0wmtbac", "perc10wfu0wfu50wmtbac",
125 "perc10wfu50wfu0wmtbac", "perc10wfu50wfu50wmtbac")]
127 d <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
128 quantile, probs = 0.5)
130 data.frame(date = as.Date(setdiff(seq(from = min(d$date),
131 to = max(d$date), by="1 day"), d$date), origin = "1970-01-01"),
132 perc10wfu0wfu0wmtbac = NA, perc10wfu0wfu50wmtbac = NA,
133 perc10wfu50wfu0wmtbac = NA, perc10wfu50wfu50wmtbac = NA))
134 d <- melt(d, id = "date")
135 ggplot(d, aes(x = date, y = value / 10000, colour = variable)) +
137 scale_y_continuous(name = paste("10th perc. \nWFU in \n",
138 "the future ", sep = ""), labels = percent, limits = c(0, 1)) +
139 scale_x_date("", breaks = "3 months", minor_breaks = "1 month",
140 labels = date_format("%b %Y")) +
141 scale_colour_manual(name = paste("Requirements for\nconsidering",
142 "a\nbridge as stable\n"), breaks = c("perc10wfu50wfu50wmtbac",
143 "perc10wfu50wfu0wmtbac", "perc10wfu0wfu50wmtbac",
144 "perc10wfu0wfu0wmtbac"), labels = c("WFU & WMTBAC", "WFU", "WMTBAC",
145 "None"), values = c("black", "grey60", "grey80", "grey45")) +
146 opts(plot.title = theme_text(size = 14 * 0.8, face = "bold"),
147 axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
149 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
151 ggsave(filename = "fwfu-sim.pdf", width = 7, height = 3, dpi = 100)
153 d <- stability[stability$time > '2010-07' & stability$time < '2011-07', ]
154 d <- d[, c("time", "perc10tosa0wfu0wmtbac", "perc10tosa0wfu50wmtbac",
155 "perc10tosa50wfu0wmtbac", "perc10tosa50wfu50wmtbac")]
157 d <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
158 quantile, probs = 0.5)
160 data.frame(date = as.Date(setdiff(seq(from = min(d$date),
161 to = max(d$date), by="1 day"), d$date), origin = "1970-01-01"),
162 perc10tosa0wfu0wmtbac = NA, perc10tosa0wfu50wmtbac = NA,
163 perc10tosa50wfu0wmtbac = NA, perc10tosa50wfu50wmtbac = NA))
164 d <- melt(d, id = "date")
165 ggplot(d, aes(x = date, y = value / 86400, colour = variable)) +
167 scale_y_continuous(name = paste("10th perc. \ntime on \nthe same \n",
168 "address \nin days ", sep = ""),
169 breaks = seq(0, max(d$value / 86400, na.rm = TRUE), 7),
170 minor = seq(0, max(d$value / 86400, na.rm = TRUE), 1),
171 limits = c(0, max(d$value / 86400, na.rm = TRUE))) +
172 scale_x_date("", breaks = "3 months", minor_breaks = "1 month",
173 labels = date_format("%b %Y")) +
174 scale_colour_manual(name = paste("Requirements for\nconsidering",
175 "a\nbridge as stable\n"), breaks = c("perc10tosa50wfu50wmtbac",
176 "perc10tosa0wfu50wmtbac", "perc10tosa50wfu0wmtbac",
177 "perc10tosa0wfu0wmtbac"), labels = c("WFU & WMTBAC", "WMTBAC", "WFU",
178 "None"), values = c("black", "grey80", "grey60", "grey45")) +
179 opts(plot.title = theme_text(size = 14 * 0.8, face = "bold"),
180 axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
182 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
184 ggsave(filename = "tosa-sim.pdf", width = 7, height = 3, dpi = 100)
186 d <- stability[stability$time > '2010-07' & stability$time < '2011-07', ]
187 d <- d[, c("time", "stablebridge0wfu50wmtbac", "stablebridge50wfu0wmtbac",
188 "stablebridge50wfu50wmtbac", "running")]
190 #d <- aggregate(d[, 2:length(d)], by = list(date = as.Date(d$time)),
191 # quantile, probs = 0.5)
193 data.frame(time = d$time, y = d$stablebridge0wfu50wmtbac / d$running,
194 variable = "WMTBAC"),
195 data.frame(time = d$time, y = d$stablebridge50wfu0wmtbac / d$running,
197 data.frame(time = d$time, y = d$stablebridge50wfu50wmtbac / d$running,
198 variable = "WFU & WMTBAC"))
199 d <- aggregate(list(y = d$y), by = list(x = as.Date(d$time),
200 variable = d$variable), quantile, probs = 0.5)
201 missing_dates <- as.Date(setdiff(seq(from = min(d$x, na.rm = TRUE),
202 to = max(d$x, na.rm = TRUE), by="1 day"), d$x), origin = "1970-01-01")
204 data.frame(x = missing_dates, y = NA,
205 variable = "WMTBAC"),
206 data.frame(x = missing_dates, y = NA,
208 data.frame(x = missing_dates, y = NA,
209 variable = "WFU & WMTBAC"))
210 ggplot(d, aes(x = x, y = y, colour = variable)) +
212 scale_y_continuous(name = "Fraction of \nRunning \nbridges ",
213 labels = percent, limits = c(0, max(d$y, na.rm = TRUE))) +
214 scale_x_date("", breaks = "3 months", minor_breaks = "1 month",
215 labels = date_format("%b %Y")) +
216 scale_colour_manual(name = paste("\nRequirements for\nconsidering",
217 "a\nbridge as stable\n"), values = c("grey80", "grey60", "grey45")) +
218 opts(axis.title.x = theme_text(size = 12 * 0.8, face = "bold",
220 axis.title.y = theme_text(size = 12 * 0.8, face = "bold", vjust = 0.5,
222 ggsave(filename = "stablebridge.pdf", width = 7, height = 3, dpi = 100)