Hi people,
I have a question that should be simple. I am new using iGraph and I am trying to plot by tklplot. The graph has the following characteristics:
我有个问题应该很简单。我是使用iGraph的新手,我正在尝试用tklplot绘图。该图具有以下特点:
Vertices: 856 Edges: 675 Directed: TRUE
顶点:856条边:675条有向的:真
I just want to shape to different ethnic groups that are of course attributes V(g)$ethnic
of the vertices, in the graph.
I had a problem with square
, but it did have a bug.
In the lines downwards I just become circle shaped vertices . My idea is to differentiate the vertices with the attribute V(g)$ethnic
, if I recall it, there is no problem , but the plot output is not true , and no major problem is reported by R
我只是想对不同的民族进行塑造这些民族当然是顶点的属性V(g)$ethnic,在图中。我对square有意见,但它确实有问题。在向下的直线中,我变成了圆形的顶点。我的想法是用属性V(g)$ethnic来区分顶点,如果我回忆一下,没有问题,但是图输出不是真的,R也没有报告大问题
as follows
如下
V(g)$color <- "green"
E(g)$color <- "black"
V(g)$nodesize=degree(g)*0.5
V(g)[V(g)$ethnic=="Mestizo"]$shape <- "rectangle"
V(g)[V(g)$ethnic=="Saraguro"]$shape <- "circle"
tkplot(g, layout=layout.kamada.kawai, edge.color=E(g)$color,
edge.arrow.size=0.3, vertex.label.dist=0.3, vertex.color=V(g)$color,
vertex.size=V(g)$nodesize, vertex.shape=V(g)$shape)
regards
Vladimir
问候弗拉基米尔
2 个解决方案
#1
1
According to the igraph.vertex.shapes function documentation, shapes are not supported in tkplot
but only in plot.igraph
:
根据igraph.vertex。图形功能文档,在tkplot中不支持图形,而仅在plot.igraph:
Note that the current vertex shape implementation is experimental and it might change in the future. Currently vertex shapes are implemented only for plot.igraph.
注意,当前的顶点形状实现是实验性的,将来可能会改变。目前,顶点形状只在plot.igraph中实现。
#2
-1
What exactly is not plotting correctly? The indices for iGraph are offset by one. Try this and see if it makes a difference:
究竟是什么没有正确地绘制?iGraph的指数被1所抵消。试试这个,看看会不会有什么不同:
wc1 <- which(V(g)$ethnic=="Mestizo") - 1
wc2 <- which(V(g)$ethnic=="Saraguro") - 1
V(g)$shape[wc1] <- "rectangle"
V(g)$shape[wc2] <- "circle"
#1
1
According to the igraph.vertex.shapes function documentation, shapes are not supported in tkplot
but only in plot.igraph
:
根据igraph.vertex。图形功能文档,在tkplot中不支持图形,而仅在plot.igraph:
Note that the current vertex shape implementation is experimental and it might change in the future. Currently vertex shapes are implemented only for plot.igraph.
注意,当前的顶点形状实现是实验性的,将来可能会改变。目前,顶点形状只在plot.igraph中实现。
#2
-1
What exactly is not plotting correctly? The indices for iGraph are offset by one. Try this and see if it makes a difference:
究竟是什么没有正确地绘制?iGraph的指数被1所抵消。试试这个,看看会不会有什么不同:
wc1 <- which(V(g)$ethnic=="Mestizo") - 1
wc2 <- which(V(g)$ethnic=="Saraguro") - 1
V(g)$shape[wc1] <- "rectangle"
V(g)$shape[wc2] <- "circle"