Hi, I am collecting data about network errors and would like to visualise the results in some sort of graph which reflects the hierarchy of the components in the network (i.e. core switches are connected to leaf switches and nodes are connected to leaf switches).
The errors are in file which looks something like this: -------- 2015-07-15;coreswitch01;1;0 2015-07-15;coreswitch01;2;0 2015-07-15;leafswitch01;1;0 2015-07-15;leafswitch01;2;0 2015-07-15;leafswitch01;3;0 2015-07-15;leafswitch01;4;0 2015-07-15;leafswitch01;5;0 2015-07-15;leafswitch02;1;0 2015-07-15;leafswitch02;2;0 2015-07-15;leafswitch02;3;0 2015-07-15;leafswitch02;4;0 2015-07-15;leafswitch02;5;0 2015-07-15;leafswitch02;2;561 2015-07-15;node001;1;0 2015-07-15;node002;1;0 2015-07-15;node003;1;0 2015-07-15;node004;1;3 2015-07-15;node005;1;10529 2015-07-15;node007;1;0 2015-07-15;node008;1;2081 -------- and the topology file, which relates ports to ports and ports to multiport components, looks something like this: -------- coreswitch01;coreswitch01_01 coreswitch01;coreswitch01_02 leafswitch01;leafswitch01_01 leafswitch01;leafswitch01_02 leafswitch01;leafswitch01_03 leafswitch01;leafswitch01_04 leafswitch01;leafswitch01_05 leafswitch02;leafswitch02_01 leafswitch02;leafswitch02_02 leafswitch02;leafswitch02_03 leafswitch02;leafswitch02_04 leafswitch02;leafswitch02_05 coreswitch01_01;leafswitch01_01 coreswitch01_02;leafswitch02_01 leafswitch01_02;node001_01 leafswitch01_03;node002_01 leafswitch01_04;node003_01 leafswitch01_05;node004_01 leafswitch02_02;node005_01 leafswitch02_03;node006_01 leafswitch02_04;node007_01 leafswitch02_05;node008_01 -------- I'm plotting the data with the following: -------- library("igraph") error_data <- read.csv(file="errors.csv",head=FALSE,sep=";") colnames(error_data) <- c("datetime","name","portnumber","generic_error"); topo_data <- read.csv(file="topology.csv",head=FALSE,sep=";") G <-graph.data.frame(topo_data, directed=F) error_counter <- 'generic_error' error_counter_max <- max(error_data[,error_counter]) vcolours <- 100 - round(99*error_data[,error_counter]/error_counter_max) hc100 <- heat.colors(100) vcolour_values <- hc100[vcolours] l <- layout_(G,as_tree(root=c(1),rootlevel=c(1))) plot(G, layout = l, vertex.shape = "rectangle", vertex.color=vcolour_values) -------- This produces roughly what I want. However, even with this subset of the full network, there is quite a lot of overlapping of vertex labels within the lowest tier. The full data set has over 100 vertices on the lowest tier, which causes the labels to become illegible. I can adjust the aspect ratio of the plot and/or the canvas, but this doesn't affect the separation between the vertices. Does anyone have any advice about how to display such information? (Completely different approaches also welcome.) Cheers, Loris -- This signature is currently under construction. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.