Description Usage Arguments Details Value Author(s) References Examples
Generates a level plot by selecting a set of nodes at the initial level '0'. Outgoing nodes are plotted on higher levels than level '0', and the incoming nodes are plotted on lower levels. This process is repeated for the nodes at each new level until all nodes are plotted. For this function, the graph can be plotted at each step, like a sequence, by using the 'plotstep' option. Edge colors show a connection between different levels. If the level difference is one, than the edgecolor is "grey" (default). For a level difference of zero, the default edge color is "brown". For level differences greater than one (upward edges), the edgecolor is "blue". If the level difference is less than zero (downward edges) the edgecolor is "red". The level plot function helps to see the information spread in a network, starting from a set of nodes (initial_nodes).
1 2 3 4 5 6 7 8 | level.plot(x, layout.function=NULL, type=1, initial_nodes=NULL,
init_nodes=0, order_degree = "in", plotsteps = FALSE,
saveplots=FALSE, dirname=NULL, vertex.colors=NULL,
edge.col=NULL, tkplot=FALSE, nodeset=NULL,path.col="green",
col.s1="red", col.s2="yellow", nodes.on.path=TRUE,v.size=2,
e.size=.5, v.lab=FALSE, bg="black", v.lab.cex=0.5,
v.lab.col="skyblue",sf=4,e.path.width=1,e.curve=.5,
level.spread=FALSE)
|
x |
|
layout.function |
|
type |
|
initial_nodes |
|
init_nodes |
|
order_degree |
|
plotsteps |
|
saveplots |
|
dirname |
|
vertex.colors |
is a vector of color names or hexadecimal codes of three colors. The first element is for vertex color at level 0, second element is for vertex color at level above level 0, third element is for vertex color lower than level 0. |
edge.col |
is a 4 dimensional vector of colors. The first element is for edges that have a level difference between nodes greater than one. The second element is for edges that are connected to nodes with a level difference less than one. The third element is for edges connecting nodes on the same level. The fourth element is for edges with a level difference between connected nodes equal to one. |
nodeset |
is a list object containing two vector. The first vector contains a set of start nodes and the second vector contains the end nodes. Shortest paths are visualized between the start nodes and end nodes. |
path.col |
is a character value for a color used to color the shortest paths between start nodes and end nodes, specified in |
col.s1 |
color of start nodes specified in |
col.s2 |
color of end nodes specified in |
nodes.on.path |
is a logical value It shows the nodes which connect start nodes and end nodes specified in |
v.size |
is a numeric value or a numeric vector which contains numeric values to assign the size of nodes. |
e.size |
is a numeric value or a numeric vector which contains numeric values to assign the width of edges. |
v.lab |
is a logical value to show vertex label. |
v.lab.cex |
is a numerical value to set the font size of vertex labels. |
v.lab.col |
is a color name or a hexadecimal color code to assign colors to vertex labels. |
sf |
A numeric value, which is a scaling factor. This is used to adjust the vertex size when |
e.path.width |
is a numeric value. This is used to adjust the edge-size of the shortest paths between start nodes and end nodes. The start nodes and end nodes are given as an input as a list object for the "nodeset" option. |
e.curve |
is a positive numeric value that adjusts the curvature of the edges which connect nodes that are on same level. |
level.spread |
is a logical value, if it is 'TRUE' then the width of each level is the same. |
bg |
name of a color or a hexadecimal code of a color. This option is used to color the background of the plot. The default option is "black". |
tkplot |
is logical value, if TRUE use the tkplot function of igraph for plotting the network. |
... |
|
This function starts plotting nodes at level 0
. These nodes are either user-defined or randomly selection. The outgoing nodes of the initial node set are plotted on the upper level and incoming nodes are plotted on the lower level. These steps are repeated until all nodes are plotted.
This function plots a graph using 'tkplot' or 'plot' function available in 'igraph'. This function returns a list. The first component of the list contains the x and y coordinates and color ids of the nodes of the graph and the second component contains a vector of edge colors.
Shailesh Tripathi, Frank Emmert-Streib
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | data("PPI_Athalina")
### Example 1 #####
#####% 5 initial nodes are picked randomly #####
id <- level.plot(g1, init_nodes =5 ,tkplot=FALSE)
### Example 2 #####
#####% initial nodes are given as an input #####
id <- level.plot(g1, initial_nodes =c(1,4,5,7,9,11,25,27,29,100,101),
tkplot=FALSE)
### Example 3 #####
#####% width of each level is same #####
id <- level.plot(g1, initial_nodes
=c(1,4,5,7,9,11,25,27,29,100,101),
level.spread = TRUE,tkplot=FALSE)
### Example 4 #####
#####% plot of graph when nodes are not arranged based on the degree #####
id <- level.plot(g1, initial_nodes
=c(1,4,5,7,9,11,25,27,29,100,101),
order_degree= NULL, level.spread = TRUE,
tkplot=FALSE)
### Example 5 #####
#####% plot of graph when nodes are not arranged based on the degree #####
id <- level.plot(g1, initial_nodes
=c(1,4,5,7,9,11,25,27,29,100,101),
order_degree= NULL, level.spread = TRUE,
tkplot=FALSE)
### Example 6 #####
###% plot of graph using a forcebased algorithm
###in igraph package #####
xx <- level.plot(g1, layout.function=layout.reingold.tilford,
initial_nodes=c(1,4,5,7,9,11,25,27,29,100,101))
xx <- level.plot(g1, layout.function=layout.fruchterman.reingold,type=2,
init_nodes=20)
xx <- level.plot(g1, layout.function=layout.kamada.kawai,
type=1, init_nodes=20)
### Example 7 #####
## Shortest path between initial set of nodes at level '0'
## to a set of nodes with vertex id 10, 1000, 1001, 1002 ##%
id <- level.plot(g1, initial_nodes=c(101,1,5,7),
vertex.colors=c("white", "white", "white"),
edge.col=c("grey", "grey", "grey", "grey"),
nodeset= list(c(101,1,5,7),c(10,1000,1001,1002)),
tkplot=FALSE, level.spread=TRUE,
order_degree=NULL)
### Example 8 #####
### A directed network is plotted with level.plot function ##%
g <- barabasi.game(300, power=0)
id <- level.plot(g, tkplot=FALSE,
level.spread=TRUE, order_degree=NULL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.