[or-cvs] [metrics/master] Automate axis labeling for dirreq diagrams.

karsten at seul.org karsten at seul.org
Tue Aug 4 22:22:39 UTC 2009


Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Tue, 4 Aug 2009 07:08:22 -0700
Subject: Automate axis labeling for dirreq diagrams.
Commit: 5764458363071a95f52d17bb793a0857db418711

---
 scripts/dirreq/geoipstats.R |   34 ++++++++++++++++------------------
 1 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/scripts/dirreq/geoipstats.R b/scripts/dirreq/geoipstats.R
index f5bd70c..0c003f0 100644
--- a/scripts/dirreq/geoipstats.R
+++ b/scripts/dirreq/geoipstats.R
@@ -24,14 +24,12 @@ ct <- "gray"
 cv <- "darkred"
 cxp <- "purple"
 
-last_day <- format(as.POSIXct(tail(h$time, n=1)), "%B %d, %Y")
-
-print(h$time)
+weekticks=c(seq(1, length(h$time)-1, 7), length(h$time))
 
 pdf("report/dirreq/total-requests.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.4))
 plot(h$reqttotal/1e3, type="l", ylim=c(0,max(na.omit(t)$reqttotal)/1e3), col=ch, axes=FALSE, ylab="Directory requests (in thousands)", xlab="Time", lwd=2)
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 lines(e$reqttotal/1e3, col=ce, lwd=2)
 lines(f$reqttotal/1e3, col=cf, lwd=2)
@@ -62,7 +60,7 @@ dev.off();
 pdf("report/dirreq/total-v2requests.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.4))
 plot(h$req2total/1e3, type="l", ylim=c(0, max(na.omit(t)$req2total)/1e3), col=ch, axes=FALSE, ylab="Directory requests (in thousands)", xlab="Time", lwd=2)
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 lines(e$req2total/1e3, col=ce, lwd=2)
 lines(f$req2total/1e3, col=ce, lwd=2)
@@ -93,7 +91,7 @@ dev.off();
 pdf("report/dirreq/total-v3requests.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.4))
 plot(h$req3total/1e3, type="l", ylim=c(0,max(na.omit(t)$req3total)/1e3), col=ch, axes=FALSE, ylab="Directory requests (in thousands)", xlab="Time", lwd=2)
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 lines(e$req3total/1e3, col=ce, lwd=2)
 lines(f$req3total/1e3, col=cf, lwd=2)
@@ -124,7 +122,7 @@ dev.off();
 pdf("report/dirreq/total-ips.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.4))
 plot(h$ipttotal/1e3, type="l", ylim=c(0,max(na.omit(t)$ipttotal)/1e3), col=ch, axes=FALSE, ylab="Unique IP addresses (in thousands)", xlab="Time", lwd=2)
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 lines(e$ipttotal/1e3, col=ce, lwd=2)
 lines(f$ipttotal/1e3, col=cf, lwd=2)
@@ -155,7 +153,7 @@ dev.off();
 pdf("report/dirreq/total-v2ips.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.4))
 plot(h$ip2total/1e3, type="l", ylim=c(0, max(na.omit(t)$ip2total)/1e3), col=ch, axes=FALSE, ylab="Unique IP addresses (in thousands)", xlab="Time", lwd=2)
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 lines(e$ip2total/1e3, col=ce, lwd=2)
 lines(f$ip2total/1e3, col=cf, lwd=2)
@@ -186,7 +184,7 @@ dev.off();
 pdf("report/dirreq/total-v3ips.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.4))
 plot(h$ip3total/1e3, type="l", ylim=c(0,max(na.omit(t)$ip3total)/1e3), col=ch, axes=FALSE, ylab="Unique IP addresses (in thousands)", xlab="Time", lwd=2)
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 lines(e$ip3total/1e3, col=ce, lwd=2)
 lines(f$ip3total/1e3, col=cf, lwd=2)
@@ -219,7 +217,7 @@ oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.4))
 plot(m2$req3total/m2$ip3total, type="l", lty=3, lwd=2, ylim=c(1,#min(na.omit(m1$req3total)/na.omit(m1$ip3total)),
 max(na.omit(t$req2total)/na.omit(t$ip2total))
 ), col=cm2, axes=FALSE, ylab="Ratio of requests to IP addresses", xlab="Time")
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 lines(g$req2total/g$ip2total, col=cg, lwd=2, lty=2)
 lines(g$req3total/g$ip3total, col=cg, lwd=2, lty=3)
@@ -257,7 +255,7 @@ pdf("report/dirreq/requests-per-ip-authorities.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.4))
 plot(m1$req3total/m1$ip3total, type="l", lty=3, lwd=2, ylim=c(1,#min(na.omit(m1$req3total)/na.omit(m1$ip3total)),
 max(na.omit(m2$req2total)/na.omit(m2$ip2total))), col=cm1, axes=FALSE, ylab="Ratio of requests to IP addresses", xlab="Time")
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 lines(m1$req2total/m1$ip2total, col=cm1, lty=2, lwd=2)
 lines(g$req3total/g$ip3total, col=cg, lty=3, lwd=2)
@@ -281,7 +279,7 @@ pdf("report/dirreq/requests-per-ip.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.4))
 plot(h$reqttotal/h$ipttotal, type="l", ylim=c(0,5.25), col=ch, axes=FALSE, ylab="Ratio of requests to IP addresses", xlab="Time", lwd=2)
 abline(h=1, lty=2)
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 lines(e$reqttotal/e$ipttotal, col=ce, lwd=2)
 lines(f$reqttotal/f$ipttotal, col=cf, lwd=2)
@@ -312,7 +310,7 @@ dev.off();
 pdf("report/dirreq/shares.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.4))
 plot(h$v2share/1e2, type="l", ylim=c(0,max(c(na.omit(t$v2share)/1e2,na.omit(v$v2share)/1e2))), col=ch, axes=FALSE, lwd=2, lty=2, xlab="Date", ylab="Share of requests (in %)")
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 lines(h$v3share/1e2, col=ch, lwd=2, lty=3)
 lines(e$v2share/1e2, col=ce, lwd=2, lty=2)
@@ -544,7 +542,7 @@ dev.off()
 pdf("report/dirreq/estimate-request-numbers.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.5))
 plot(h$req3estimate/1e6, axes=FALSE, col=ch, type="l", lwd=2, ylim=c(0, 5), ylab="Directory requests (in millions)", xlab="Time", main="Estimated number of directory requests in the network per day")
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 #lines(e$req3estimate/1e6, lwd=2, col=ce)
 #lines(m5$req3estimate/1e6, lwd=2, col=cm5)
@@ -567,7 +565,7 @@ dev.off()
 pdf("report/dirreq/estimate-requests-per-ip.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.5))
 plot(h$reqperip3, axes=FALSE, col=ch, type="l", lwd=2, ylim=c(0, max(na.omit(b$reqperip3))), ylab="Requests per IP address", xlab="Time", main="Estimated number of directory requests per IP address")
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 #lines(e$reqperip3, lwd=2, col=ce)
 #lines(m5$reqperip3, lwd=2, col=cm5)
@@ -590,7 +588,7 @@ dev.off()
 pdf("report/dirreq/estimate-client-numbers.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.5))
 plot(h$ip3estimate/1e3, axes=FALSE, col=ch, type="l", lwd=2, ylim=c(0, max(na.omit(v$ip3estimate/1e3))), ylab="Unique IP addresses (in thousands)", xlab="Time", main="Estimated number of unique IP addresses in the network per day")
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 #lines(e$ip3estimate/1e3, lwd=2, col=ce)
 #lines(m5$ip3estimate/1e3, lwd=2, col=cm5)
@@ -613,7 +611,7 @@ dev.off()
 pdf("report/dirreq/estimate-conservative-client-numbers.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.5))
 plot(h$req3estimate/1e4, axes=FALSE, col=ch, type="l", lwd=2, ylim=c(0, max(na.omit(b$req3estimate/1e4))), ylab="Unique IP addresses (in thousands)", xlab="Time", main="Estimated number of unique IP addresses in the network per day")
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 #lines(e$req3estimate/1e4, lwd=2, col=ce)
 #lines(m5$req3estimate/1e4, lwd=2, col=cm5)
@@ -639,7 +637,7 @@ pdf("report/dirreq/estimate-new-users.pdf", width=8, height=5)
 oldpar <- par(mar=c(4.1, 3.9, 1.4, 5.5))
 plot(m1$req3total/1e3/m1ishare, type="l", #ylim=c(0,max(na.omit(m1$req3total/1e3/m1ishare))),
 col=cm1, axes=FALSE, ylab="New users (in thousands)", xlab="Time", main="Estimated number of new or returning users in the network per day", lwd=2)
-axis(1, at=c(seq(1, length(h$time)-1, 7), length(h$time)), labels=c("May 28, 2009", "June 4", "June 11", "June 18", last_day))
+axis(1, at=weekticks, labels=format(as.POSIXct(h$time[weekticks], tz="GMT"), "%B %d"))
 axis(2, las=1)
 lines(g$req3total/1e3/gshare, col=cg, lwd=2)
 lines(i$req3total/1e3/m1ishare, col=ci, lwd=2)
-- 
1.5.6.5




More information about the tor-commits mailing list