[tor-commits] [metrics-tasks/master] Update plotting code for #6232.

karsten at torproject.org karsten at torproject.org
Sun Jul 15 05:36:20 UTC 2012


commit 82d18a95d064b1e0018cb85549fb21bb46bddce1
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Sun Jul 15 07:29:49 2012 +0200

    Update plotting code for #6232.
---
 task-6232/plot-entropy.R |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/task-6232/plot-entropy.R b/task-6232/plot-entropy.R
index 1334b88..95dbdcc 100644
--- a/task-6232/plot-entropy.R
+++ b/task-6232/plot-entropy.R
@@ -1,10 +1,19 @@
 library(ggplot2)
+library(reshape)
 d <- read.csv("entropy.csv", header = FALSE,
-  col.names = c("validafter", "entropy"))
-ggplot(d, aes(x = as.POSIXct(validafter), y = entropy)) +
+  col.names = c("validafter", "all", "exit", "guard", "country"))
+d <- aggregate(
+  list(all = d$all, exit = d$exit, guard = d$guard, country = d$country),
+  by = list(date = as.Date(d$validafter, origin = "1970-01-01 00:00:00")),
+  FUN = median)
+d <- melt(d, "date")
+ggplot(d, aes(x = date, y = value, colour = variable)) +
 geom_line() +
-scale_x_datetime(name = "\nDate") +
-scale_y_continuous(name = "Entropy\n")
+scale_x_date(name = "\nDate") +
+scale_y_continuous(name = "Entropy\n") +
+scale_colour_hue(name = "Relays",
+  breaks = c("all", "exit", "guard", "country"),
+  labels = c("All relays", "All exits", "All guards", "All countries"))
 ggsave("entropy.png", width = 8, height = 6, dpi = 100)
 
 



More information about the tor-commits mailing list