plotHierarchicalEdgeBundles: Hierarchical Edge Bundling

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/plotHierarchicalEdgeBundles.R

Description

Visualization of networks using hierarchical edge bundles referenced below. Plots a graph using a hierachical tree as guides for the edges.

Usage

1
2
3
4
plotHierarchicalEdgeBundles(phylo, graph, beta = 0.8,
  include.mrca = FALSE, simplify = FALSE, ..., args.lines = list(),
  args.points = list(pch = 16, cex = 0.1), debug = FALSE, e.cols,
  v.use.only, e.use.only)

Arguments

phylo

A phylo object defining the hierarchy.

graph

A igraph object to be drawn.

beta

A number between 0 and 1 controlling the bundling strength.

include.mrca

Should the only the most recent common ancestor be used in the shortest path used for the splines?

simplify

Simplify the paths by taking the convex hull of the control points. Can sometimes yield better results.

...

Arguments passed to plot.phylo.

args.lines

A list of arguments passed to lines.

args.points

A list of arguments passed to points.

debug

Plot some extra debug info.

e.cols

A character vector giving the colors of the edges. Overrides any use of args.lines$col.

v.use.only

An integer vector giving the nodes from which edges are to be drawn. E.g. use.only = 1 will only plot the edges from vertex 1.

e.use.only

An integer vector giving the edges to be drawn. E.g. use.only = 1 will only draw the first edge.

Value

Plots to a new device.

Author(s)

Anders Ellern Bilgrau <anders.ellern.bilgrau (at) gmail.com>

References

Holten, Danny. "Hierarchical edge bundles: Visualization of adjacency relations in hierarchical data." Visualization and Computer Graphics, IEEE Transactions on 12.5 (2006): 741-748.

See Also

See plot.phylo.

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
library("igraph")
library("ape")
n <- 10
  
# Create a graph
corr <- cor(matrix(rnorm(n^2), n, n))
rownames(corr) <- colnames(corr) <- 
  apply(combn(LETTERS, 2), 2, paste0, collapse = "")[1:n]
adj <- abs(corr)
graph <- graph.adjacency(adj, mode = "un", weighted = TRUE, diag = FALSE)
E(graph)$color <- ifelse(get.lower.tri(corr) < 0, "blue", "red")

phylo <- as.phylo(hclust(as.dist(1 - adj), method = "ward.D"))
plotHierarchicalEdgeBundles(phylo, graph, type = "fan",
                            e.cols = E(graph)$color)

par(mfrow = c(1, 3), mar = c(0, 0, 0, 0))
plot(phylo, type = "fan")
plotHierarchicalEdgeBundles(phylo, graph, type = "fan", beta = 0.95,
                            args.lines = list(col = alp("steelblue", 90)))
plotHierarchicalEdgeBundles(phylo, graph, type = "fan", beta = 0.85,
                            args.lines = list(col = alp("steelblue", 90)))
             
# Extra control of plotting and debugging               
par(mfrow = c(1,2))
plot(phylo, type = "unrooted")        
plotHierarchicalEdgeBundles(phylo, graph, type = "unrooted", beta = 0.8,
                            v.use.only = 1, debug = FALSE,
                            args.lines = list(col = alp("red", 1), lwd = 2))

AEBilgrau/Bmisc documentation built on Jan. 17, 2019, 10:10 a.m.