-
Notifications
You must be signed in to change notification settings - Fork 2
/
gen-traffic-plot.r
executable file
·40 lines (36 loc) · 1.42 KB
/
gen-traffic-plot.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
library(ggplot2)
library(sitools)
data = read.csv('packet-lens-no-apple-tv-no-iphone-no-ipad.csv')
data$timestamp = as.POSIXct(data$timestamp, origin="1970-01-01", tz="GMT")
#ggplot(data, aes(timestamp, io)) +
# labs(x = "Time", y = "Traffic (bytes)") +
# geom_line() +
# #scale_x_date(format = "%b-%Y")
# theme_bw() +
# #scale_fill_brewer(palette = 'Set2') +
# scale_y_continuous(labels=f2si) +
# theme(
# #panel.grid.major = element_line(colour = "white"),
# #panel.grid.minor = element_line(colour = "white"),
# #axis.text = element_text(size = 18),
# axis.text.x = element_text(angle=90,hjust=1,vjust=0.5),
# #axis.title = element_text(size = 20, face="bold")
# )
#ggsave('packet-lens.pdf', width=10, height=5)
data = aggregate(list(io = data$io), list(timestamp = cut(data$timestamp, "1 hour")), sum)
data$timestamp = as.POSIXct(data$timestamp, origin="1970-01-01", tz="GMT")
ggplot(data, aes(timestamp, io)) +
labs(x = "Time", y = "Traffic (bytes)") +
geom_line() +
#scale_x_date(format = "%b-%Y")
theme_bw() +
#scale_fill_brewer(palette = 'Set2') +
scale_y_continuous(labels=f2si) +
theme(
#panel.grid.major = element_line(colour = "white"),
#panel.grid.minor = element_line(colour = "white"),
#axis.text = element_text(size = 18),
axis.text.x = element_text(angle=90,hjust=1,vjust=0.5),
#axis.title = element_text(size = 20, face="bold")
)
ggsave('packet-lens-hourly-no-apple-tv-no-iphone-no-ipad.pdf', width=10, height=5)