Function to visualise the multiple graph colorings reorded within a sheet-shape rectangle grid


visNetReorder is supposed to visualise the multiple graph colorings reorded within a sheet-shape rectangle grid


visNetReorder(g, data, sReorder, height = 7, margin = rep(0.1, 4), border.color = "#EEEEEE", 
  colormap = c("bwr", "jet", "gbr", "wyr", "br", "yr", "rainbow", "wb"), ncolors = 40, 
      zlim = NULL, colorbar = T, colorbar.fraction = 0.5, newpage = T, glayout = layout.fruchterman.reingold, 
      mtext.side = 3, mtext.adj = 0, mtext.cex = 1, mtext.font = 2, mtext.col = "black", 


an object of class "igraph" or "graphNEL"
an input data matrix used to color-code vertices/nodes. One column corresponds to one graph node coloring. The input matrix must have row names, and these names should include all node names of input graph, i.e. V(g)$name, since there is a mapping operation. After mapping, the length of the pattern vector should be the same as the number of nodes of input graph. The way of how to color-code is to map values in the pattern onto the whole colormap (see the next arguments: colormap, ncolors, zlim and colorbar)
an object of class "sReorder"
a numeric value specifying the height of device
margins as units of length 4 or 1
the border color of each figure
short name for the colormap. It can be one of "jet" (jet colormap), "bwr" (blue-white-red colormap), "gbr" (green-black-red colormap), "wyr" (white-yellow-red colormap), "br" (black-red colormap), "yr" (yellow-red colormap), "wb" (white-black colormap), and "rainbow" (rainbow colormap, that is, red-yellow-green-cyan-blue-magenta). Alternatively, any hyphen-separated HTML color names, e.g. "blue-black-yellow", "royalblue-white-sandybrown", "darkgreen-white-darkviolet". A list of standard color names can be found in
the number of colors specified over the colormap
the minimum and maximum z/patttern values for which colors should be plotted, defaulting to the range of the finite values of z. Each of the given colors will be used to color an equispaced interval of this range. The midpoints of the intervals cover the range, so that values just outside the range will be plotted
logical to indicate whether to append a colorbar. If pattern is null, it always sets to false
the relative fraction of colorbar block against the figure block
logical to indicate whether to open a new page. By default, it sets to true for opening a new page
either a function or a numeric matrix configuring how the vertices will be placed on the plot. If layout is a function, this function will be called with the graph as the single parameter to determine the actual coordinates. This function can be one of "", "layout.random", "", "layout.sphere", "layout.fruchterman.reingold", "layout.kamada.kawai", "layout.spring", "layout.reingold.tilford", "layout.fruchterman.reingold.grid", "layout.lgl", "layout.graphopt", "layout.svd" and "layout.norm". A full explanation of these layouts can be found in
on which side of the mtext plot (1=bottom, 2=left, 3=top, 4=right)
the adjustment for mtext alignment (0 for left or bottom alignment, 1 for right or top alignment)
the font size of mtext labels
the font weight of mtext labels
the color of mtext labels
additional graphic parameters. See for the complete list.






# 1) generate a random graph according to the ER model g <-, 1/100) # 2) produce the induced subgraph only based on the nodes in query subg <- dNetInduce(g, V(g), knn=0) # 3) reorder the module with vertices being color-coded by input data nnodes <- vcount(subg) nsamples <- 10 data <- matrix(runif(nnodes*nsamples), nrow=nnodes, ncol=nsamples) rownames(data) <- V(subg)$name sReorder <- dNetReorder(g=subg, data, feature="node", node.normalise="none")
Start at 2017-03-27 20:03:54 First, define topology of a map grid (2017-03-27 20:03:54)... Second, initialise the codebook matrix (36 X 10) using 'linear' initialisation, given a topology and input data (2017-03-27 20:03:54)... Third, get training at the rough stage (2017-03-27 20:03:54)... 1 out of 360 (2017-03-27 20:03:54) 36 out of 360 (2017-03-27 20:03:54) 72 out of 360 (2017-03-27 20:03:54) 108 out of 360 (2017-03-27 20:03:54) 144 out of 360 (2017-03-27 20:03:54) 180 out of 360 (2017-03-27 20:03:54) 216 out of 360 (2017-03-27 20:03:54) 252 out of 360 (2017-03-27 20:03:54) 288 out of 360 (2017-03-27 20:03:54) 324 out of 360 (2017-03-27 20:03:54) 360 out of 360 (2017-03-27 20:03:54) Fourth, get training at the finetune stage (2017-03-27 20:03:54)... 1 out of 1440 (2017-03-27 20:03:54) 144 out of 1440 (2017-03-27 20:03:54) 288 out of 1440 (2017-03-27 20:03:54) 432 out of 1440 (2017-03-27 20:03:54) 576 out of 1440 (2017-03-27 20:03:54) 720 out of 1440 (2017-03-27 20:03:54) 864 out of 1440 (2017-03-27 20:03:54) 1008 out of 1440 (2017-03-27 20:03:54) 1152 out of 1440 (2017-03-27 20:03:54) 1296 out of 1440 (2017-03-27 20:03:54) 1440 out of 1440 (2017-03-27 20:03:55) Next, identify the best-matching hexagon/rectangle for the input data (2017-03-27 20:03:55)... Finally, append the response data (hits and mqe) into the sMap object (2017-03-27 20:03:55)... Below are the summaries of the training results: dimension of input data: 10x10 xy-dimension of map grid: xdim=6, ydim=6, r=3 grid lattice: rect grid shape: sheet dimension of grid coord: 36x2 initialisation method: linear dimension of codebook matrix: 36x10 mean quantization error: 0.232787363343837 Below are the details of trainology: training algorithm: sequential alpha type: invert training neighborhood kernel: gaussian trainlength (x input data length): 36 at rough stage; 144 at finetune stage radius (at rough stage): from 1 to 1 radius (at finetune stage): from 1 to 1 End at 2017-03-27 20:03:55 Runtime in total is: 1 secs
# 4) visualise the module with vertices being color-coded by input data visNetReorder(g=subg, colormap="bwr", data=data, sReorder)