Ticket #22236: bwhist-per-user.R

File bwhist-per-user.R, 850 bytes (added by karsten, 2 years ago)
Line 
1require(ggplot2)
2require(reshape)
3require(scales)
4theme_update(plot.title = element_text(hjust = 0.5))
5
6c2 <- read.csv("clients.csv", stringsAsFactors = FALSE)
7c2 <- c2[c2$node == "relay" & c2$country == "", c("date", "clients")]
8b2 <- read.csv("bandwidth.csv", stringsAsFactors = FALSE)
9b2 <- b2[b2$isexit == "" & b2$isguard == "", c("date", "bwread", "bwwrite")]
10m2 <- rbind(
11  data.frame(date = as.Date(c2$date), variable = "clients", value = c2$clients),
12  data.frame(date = as.Date(b2$date), variable = "bwhist",
13    value = ((b2$bwread + b2$bwwrite) * 8) / 2))
14m2 <- cast(m2)
15ggplot(m2, aes(x = date, y = (bwhist / clients) / 1000)) +
16geom_line() +
17scale_x_date(name = "") +
18scale_y_continuous(name = "") +
19expand_limits(y = 0) +
20ggtitle("Traffic generated per user (kbit/s)\n")
21ggsave("bwhist-per-user.png", width = 8, height = 5, dpi = 100)
22