[tor-commits] [metrics-tasks/master] Add the graphing code for #1890.

karsten at torproject.org karsten at torproject.org
Wed Mar 28 06:57:36 UTC 2012


commit 0b1ba07f337f672fcc79d90c99cb1aa5b3bcac16
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Wed Mar 28 08:57:16 2012 +0200

    Add the graphing code for #1890.
---
 task-1890/.gitignore                |    4 ++++
 task-1890/deviant-consensus-times.R |   17 +++++++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/task-1890/.gitignore b/task-1890/.gitignore
new file mode 100644
index 0000000..add66bd
--- /dev/null
+++ b/task-1890/.gitignore
@@ -0,0 +1,4 @@
+*.pdf
+*.txt
+*.png
+
diff --git a/task-1890/deviant-consensus-times.R b/task-1890/deviant-consensus-times.R
new file mode 100644
index 0000000..68de181
--- /dev/null
+++ b/task-1890/deviant-consensus-times.R
@@ -0,0 +1,17 @@
+# Usage: Save consensus valid-after times to deviant-consensus-times.txt
+#        with lines formatted as "YYYY-MM-DD-HH-MM-SS-consensus" and run
+#        R --slave -f deviant-consensus-times.R
+library(ggplot2)
+c <- read.table("deviant-consensus-times.txt", header = FALSE,
+  stringsAsFactors = FALSE)
+c <- data.frame(
+  month = as.Date(paste(substr(c$V1, 1, 7), "-01", sep = "")),
+  datetime = as.POSIXct(paste("1971-03-", substr(c$V1, 9, 19), sep = ""),
+  format = "%Y-%m-%d-%H-%M-%S"))
+ggplot(c, aes(x = datetime, y = month)) +
+geom_point(color = "red") +
+scale_x_datetime(name = "\nDay of month and time", format = "%d") +
+scale_y_date(name = "Month\n", format = "%Y-%m") +
+opts(title = "Deviant consensuses\n")
+ggsave("deviant-consensus-times.png", width = 8, height = 6, dpi = 72)
+



More information about the tor-commits mailing list