xLayout: Function to define graph node coordinates according to...

Description Usage Arguments Value See Also Examples

Description

xLayout is supposed to define graph node coordinates according to igraph- or sna-style layout.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
xLayout(g, layout = c("layout_nicely", "layout_randomly",
"layout_in_circle", "layout_on_sphere", "layout_with_fr",
"layout_with_kk", "layout_as_tree", "layout_with_lgl",
"layout_with_graphopt", "layout_with_sugiyama", "layout_with_dh",
"layout_with_drl", "layout_with_gem", "layout_with_mds",
"layout_as_bipartite", "gplot.layout.adj", "gplot.layout.circle",
"gplot.layout.circrand", "gplot.layout.eigen",
"gplot.layout.fruchtermanreingold", "gplot.layout.geodist",
"gplot.layout.hall", "gplot.layout.kamadakawai", "gplot.layout.mds",
"gplot.layout.princoord", "gplot.layout.random", "gplot.layout.rmds",
"gplot.layout.segeo", "gplot.layout.seham", "gplot.layout.spring",
"gplot.layout.springrepulse", "gplot.layout.target"), seed = 825)

Arguments

g

an object of class "igraph" (or "graphNEL") for a graph

layout

a character specifying graph layout function. This character can be used to indicate igraph-style layout ("layout_nicely","layout_randomly","layout_in_circle","layout_on_sphere","layout_with_fr","layout_with_kk","layout_as_tree","layout_with_lgl","layout_with_graphopt","layout_with_sugiyama","layout_with_dh","layout_with_drl","layout_with_gem","layout_with_mds","layout_as_bipartite"), or sna-style layout ("gplot.layout.adj","gplot.layout.circle","gplot.layout.circrand","gplot.layout.eigen","gplot.layout.fruchtermanreingold","gplot.layout.geodist","gplot.layout.hall","gplot.layout.kamadakawai","gplot.layout.mds","gplot.layout.princoord","gplot.layout.random","gplot.layout.rmds","gplot.layout.segeo","gplot.layout.seham","gplot.layout.spring","gplot.layout.springrepulse","gplot.layout.target")

seed

an integer specifying the seed

Value

It returns an igraph object, appended by node attributes including "xcoord" for x-coordinates, "ycoord" for y-coordiates.

See Also

xGGnetwork

Examples

 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
## Not run: 
# Load the library
library(XGR)
RData.location <- "http://galahad.well.ox.ac.uk/bigdata/"

# load REACTOME
# restricted to Immune System ('R-HSA-168256') or Signal Transduction ('R-HSA-162582')
g <- xRDataLoader('ig.REACTOME', RData.location=RData.location)
neighs.out <- igraph::neighborhood(g, order=vcount(g),
nodes="R-HSA-168256", mode="out")
nodeInduced <- V(g)[unique(unlist(neighs.out))]$name
ig <- igraph::induced.subgraph(g, vids=nodeInduced)

# compare Fruchterman and Reingold force-directed placement algorithm
## based on igraph layout
ig1 <- xLayout(ig, layout="layout_with_fr")
gp1 <- xGGnetwork(ig1, node.xcoord="xcoord", node.ycoord="ycoord")
## based on sna layout
ig2 <- xLayout(ig, layout="gplot.layout.fruchtermanreingold")
gp2 <- xGGnetwork(ig2, node.xcoord="xcoord", node.ycoord="ycoord")

# compare Kamada-Kawai force-directed placement algorithm
## based on igraph layout
ig1 <- xLayout(ig, layout="layout_with_kk")
gp1 <- xGGnetwork(ig1, node.xcoord="xcoord", node.ycoord="ycoord")
## based on sna layout
ig2 <- xLayout(ig, layout="gplot.layout.kamadakawai")
gp2 <- xGGnetwork(ig2, node.xcoord="xcoord", node.ycoord="ycoord")

## End(Not run)

XGR documentation built on June 18, 2019, 3:01 p.m.

Related to xLayout in XGR...