2 data <- read.csv("hsdir-sessions.csv", stringsAsFactors = FALSE)
4 ## Histogram; not that useful
5 #ggplot(data, aes(x = duration / 3600)) +
6 #geom_histogram(aes(y = ..density..), binwidth = 1) +
7 #scale_x_continuous(limits = c(0, 72)) +
8 #scale_y_continuous(formatter = "percent")
10 # We want to compare actual session times to...
11 hour24 <- sort(data$duration)
13 # ... simulated session times if HSDir flags would have been assigned
14 # after 25 or 26 hours, not 24.
15 hour25 <- data[data$duration >= 3600, "duration"]
16 hour25 <- sort(hour25) - 3600
17 hour26 <- data[data$duration >= 7200, "duration"]
18 hour26 <- sort(hour26) - 7200
21 data.frame(x = hour24 / (60 * 60),
22 y = (length(hour24):1) / length(hour24),
23 type = "24 hours (implemented)"),
24 data.frame(x = hour25 / (60 * 60),
25 y = (length(hour25):1) / length(hour25),
26 type = "25 hours (simulated)"),
27 data.frame(x = hour26 / (60 * 60),
28 y = (length(hour26):1) / length(hour26),
29 type = "26 hours (simulated)"))
31 ggplot(data[data$type == "24 hours (implemented)", ], aes(x = x, y = y)) +
33 scale_y_continuous("Cumulative fraction of continuous HSDir sessions\n",
34 formatter = "percent", limits = c(0, 1)) +
35 scale_x_continuous(paste("\nHSDir session time between the relay earning",
36 "the HSDir flag and going away in hours"),
37 limits = c(0, 3 * 24), breaks = seq(0, 3 * 24, 24))
38 ggsave(filename = "hsdir-sessions.png", width = 8, height = 5, dpi = 72)
40 ggplot(data, aes(x = x, y = y, colour = type)) +
42 scale_y_continuous("Cumulative fraction of continuous HSDir sessions\n",
43 formatter = "percent", limits = c(0, 1)) +
44 scale_x_continuous(paste("\nHSDir session time between the relay earning",
45 "the HSDir flag and going away in hours"),
46 limits = c(0, 3 * 24), breaks = seq(0, 3 * 24, 24)) +
47 scale_colour_hue("HSDir flag assignment after") +
48 opts(legend.position = "top")
49 ggsave(filename = "hsdir-sessions-sim.png", width = 8, height = 5,