1

I am using an NS3 based simulator called NDNsim. I can generate certain trace files that can be used to analyze performance, etc. However I need to visualize the data generated.

I am a complete Novice with R, and would like a way to visualize. Here is how the output looks from which I would to plot. Any help is appreciated.

Karan
  • 141
  • 8
  • 1
    What type of plot do you want? With that data so many can be produced... – Rui Barradas Aug 10 '20 at 21:16
  • @RuiBarradas Simple line plots like Time v/s InData (with others). There is one script I am using but would like a way to make separate graphs for the metrics. The current script I am using: https://github.com/cawka/ndnSIM-tutorial/blob/master/graphs/graph.R – Karan Aug 10 '20 at 21:23

2 Answers2

2

It's pretty difficult to know what you're looking for, since you have almost 50,000 measurements across 9 variables. Here's one way of getting a lot of that information on the screen:

df <- read.table(paste0("https://gist.githubusercontent.com/wuodland/",
                        "9b2c76650ea37459f869c59d5f5f76ea/raw/",
                        "6131919c105c95f8ba6967457663b9c37779756a/rate.txt"),
                 header = TRUE)

library(ggplot2)

ggplot(df, aes(x = Time, y = Kilobytes, color = Type)) + 
  geom_line() + 
  facet_wrap(~FaceDescr)

enter image description here

Allan Cameron
  • 147,086
  • 7
  • 49
  • 87
  • Thanks for your reply, somethings are making way more sense now with you using facet_wrap. I was using node in it instead of faceDescr like you posted. I think this is a good place for me to start and make the graphs better suited for my use. Basically, I wanted to plot Kilobytes v/s Time graph for the different nodes(with line plots for the attributes). But it seems using facedescr makes more sense because facet_wrap with node. This is how I used to get on my own: https://i.imgur.com/FM3pnKh.png edit: it seems graphs generated depend on monitor resolution, looks better on higher res – Karan Aug 10 '20 at 22:24
1

You could look into making sub structures from your input file and then graphing that by node, instead of trying to somehow invoke the plotter in just the right way.

df <- read.table(paste0("https://gist.githubusercontent.com/wuodland/",
                        "9b2c76650ea37459f869c59d5f5f76ea/raw/",
                        "6131919c105c95f8ba6967457663b9c37779756a/rate.txt"),
                 header = TRUE)

smaller_df <- df[which(df$Type=='InData'), names(df) %in% c("Time", "Node", 
                 "FaceId", "FaceDescr", "Type", "Packets", "Kilobytes",
                 "PacketRaw", "KilobyteRaw")]

ggplot(smaller_df, aes(x = Time, y = Kilobytes, color = Type)) 
       + geom_line() 
       + facet_wrap (~ Node)

The above snippet makes a smaller data frame from your original text data using only the "InData" Type, and then plots that by nodes.

user42128
  • 11
  • 1