r - igraph 1.0 cannot plot trees in mode "in" -
the tree layout of igraph
(1.0.1) doesn't work when trees "in" instead of "out". instance, these trees plotted if no layout used:
library(igraph) # create tree graph. vertex 1 root. tree <- graph.empty(15) tree <- tree + path(5,4,3,2,1) tree <- tree + path(8,7,6,5) tree <- tree + path(15,14,13,12,11,10,9,5) # make_tree new in igraph 1.0 tree.in <- make_tree(20, 3, mode="in") tree.out <- make_tree(20, 3, mode="out") par(mfrow=c(1,3)) ### no layout plot(tree, vertex.label=na, vertex.size=6, edge.arrow.size=0.1) title("tree") plot(tree.in, vertex.label=na, vertex.size=6, edge.arrow.size=0.1) title("tree.in") plot(tree.out, vertex.label=na, vertex.size=6, edge.arrow.size=0.1) title("tree.out")
however, if tree reingold-tilford layout called, can plot tree.out
### tree layout plot(tree, vertex.label=na, vertex.size=6, edge.arrow.size=0.1, layout=layout.reingold.tilford(tree, mode="in")) title("tree") plot(tree.in, vertex.label=na, vertex.size=6, edge.arrow.size=0.1, layout=layout_as_tree(tree.in, mode="in")) title("tree.in") plot(tree.out, vertex.label=na, vertex.size=6, edge.arrow.size=0.1, layout=layout_as_tree(tree.out, mode="out")) title("tree.out")
for first two, error is:
error in match.arg(arg = arg, choices = choices, several.ok = several.ok) : 'arg' should 1 of “out”
am doing wrong or bug of igraph
?
igraph 0.7.1:
in igraph 0.7.1 example works fine:
tree <- graph.empty(15) tree <- tree + path(5,4,3,2,1) tree <- tree + path(8,7,6,5) tree <- tree + path(15,14,13,12,11,10,9,5) par(mfrow=c(1,2)) plot(tree, vertex.label=na, vertex.size=6, edge.arrow.size=0.1) title("no layout") plot(tree, vertex.label=na, vertex.size=6, edge.arrow.size=0.1, layout=layout.reingold.tilford(tree, mode="in")) title("layout")
Comments
Post a Comment