[tor-commits] [metrics-tasks/master] Update #6232 graphing code to ASes.

karsten at torproject.org karsten at torproject.org
Wed Jul 25 10:32:12 UTC 2012


commit a213be8ad0796edb4e9ffdfa470f17fe2671642e
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Wed Jul 25 12:28:59 2012 +0200

    Update #6232 graphing code to ASes.
---
 task-6232/plot-entropy.R |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/task-6232/plot-entropy.R b/task-6232/plot-entropy.R
index ab57678..0ed4bac 100644
--- a/task-6232/plot-entropy.R
+++ b/task-6232/plot-entropy.R
@@ -4,18 +4,21 @@ library(scales)
 
 d <- read.csv("entropy.csv", header = FALSE,
   col.names = c("validafter", "all", "max_all", "exit", "max_exit",
-  "guard", "max_guard", "country", "max_country"))
+  "guard", "max_guard", "country", "max_country", "as", "max_as"))
 
 e <- aggregate(
   list(all = d$all / d$max_all, exit = d$exit / d$max_exit,
-  guard = d$guard / d$max_guard, country = d$country / d$max_country),
+  guard = d$guard / d$max_guard, country = d$country / d$max_country,
+  as = d$as / d$max_as),
   by = list(date = as.Date(d$validafter, origin = "1970-01-01 00:00:00")),
   FUN = median)
 e <- melt(e, "date")
-e <- data.frame(date = e$date, variable = ifelse(e$variable == "all",
-  "All relays", ifelse(e$variable == "exit", "All exits",
-  ifelse(e$variable == "guard", "All guards", "All countries"))),
-  value = e$value)
+e <- data.frame(date = e$date, variable =
+  ifelse(e$variable == "all", "All relays",
+  ifelse(e$variable == "exit", "All exits",
+  ifelse(e$variable == "guard", "All guards",
+  ifelse(e$variable == "country", "All countries",
+  "All ASes")))), value = e$value)
 ggplot(e, aes(x = date, y = value)) +
 geom_line() +
 facet_wrap(~ variable) +
@@ -26,7 +29,8 @@ ggsave("degree-of-anonymity.png", width = 8, height = 6, dpi = 100)
 
 f <- aggregate(list(all = d$all, max_all = d$max_all, exit = d$exit,
   max_exit = d$max_exit, guard = d$guard, max_guard = d$max_guard,
-  country = d$country, max_country = d$max_country),
+  country = d$country, max_country = d$max_country, as = d$as,
+  max_as = d$max_as),
   by = list(date = as.Date(d$validafter, origin = "1970-01-01 00:00:00")),
   FUN = median)
 f <- rbind(
@@ -37,7 +41,9 @@ f <- rbind(
   data.frame(date = f$date, entropy = f$guard, max = f$max_guard,
     type = "All guards"),
   data.frame(date = f$date, entropy = f$country, max = f$max_country,
-    type = "All countries"))
+    type = "All countries"),
+  data.frame(date = f$date, entropy = f$as, max = f$max_as,
+    type = "All ASes"))
 f <- melt(f, c("date", "type"))
 ggplot(f, aes(x = date, y = value, colour = variable)) +
 geom_line() +





More information about the tor-commits mailing list