Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 1 | #!/usr/bin/env Rscript |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 2 | # Copyright (c) 2012-2015 Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 3 | |
| 4 | |
| 5 | # install.packages ('ggplot2') |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 6 | library(ggplot2) |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 7 | ## # install.packages ('scales') |
| 8 | ## library (scales) |
| 9 | |
| 10 | ######################### |
| 11 | # Rate trace processing # |
| 12 | ######################### |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 13 | data = read.table("drop-trace.txt", header=T) |
| 14 | data$Node = factor(data$Node) |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 15 | data$Kilobits <- data$Kilobytes * 8 |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 16 | data$Type = factor(data$Type) |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 17 | |
| 18 | ## data.rtr = data[grep("Rtr", data$Node),] |
| 19 | |
| 20 | # graph rates on all nodes in Kilobits |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 21 | g.all <- ggplot(data, aes(x=Time, y=Kilobits, color=Type)) + |
| 22 | geom_point(size=2) + |
| 23 | geom_line() + |
| 24 | ylab("Packet drop rate [Kbits/s]") + |
| 25 | facet_wrap(~ Node) + |
| 26 | theme_bw() |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 27 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 28 | png("src/ndnSIM/docs/source/_static/l2-rate-tracer.png", width=800, height=500) |
| 29 | print(g.all) |
| 30 | x = dev.off() |