Add code for web logs analysis (#20008).
[tor-metrics-tasks.git] / task-4686 / download-stats.R
blobbd4f065c49a50143f661c21c9c443a125a70bbe2
1 library(ggplot2)
3 u <- read.csv("download-stats-usa.csv", header = FALSE,
4   col.names = c("dirauth", "download", "seconds"))
5 e <- read.csv("download-stats-europe.csv", header = FALSE,
6   col.names = c("dirauth", "download", "seconds"))
7 d <- rbind(
8   data.frame(u, host = "U.S.A."),
9   data.frame(e, host = "Europe"))
10 d <- d[d$download >= min(e$download), ]
11 ggplot(d, aes(x = as.POSIXct(download / 1000,
12   origin = "1970-01-01 00:00:00"), y = seconds / 1000, colour = host)) +
13 geom_point(alpha = 0.25) +
14 facet_wrap(~ dirauth) +
15 scale_x_datetime(name = "", major = "1 week", minor = "1 day",
16   format = "%b %d") +
17 scale_y_continuous(name = "", limits = c(0, max(d$seconds) / 1000)) +
18 scale_colour_hue(name = "") +
19 opts(title = "Consensus download times in seconds\n")
20 ggsave("download-stats-comparison.png", width = 8, height = 6, dpi = 100)