igraph 1.0无法在模式中绘制树木"在"

时间:2015-08-25 05:50:15

标签: r igraph

当树木在"""时,igraph(1.0.1)的树形布局无法正常工作。而不是" out"。例如,如果没有使用布局,则可以正确绘制这些树:

library(igraph)

# Create tree graph. Vertex 1 is 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 is 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")

trees 但是,如果调用树Reingold-Tilford布局,那么它只能绘制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")

enter image description here

对于前两个,错误是:

  

match.arg中的错误(arg = arg,choices = choices,few.ok =   几个人:&#39; arg&#39;应该是“出局”之一

我做错了什么或这是igraph的错误?

IGRAPH 0.7.1

在igraph 0.7.1中,这个例子很好用:

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")

enter image description here

0 个答案:

没有答案