如何在igraph中将不同的图像分配给不同的顶点? [英] How to assign different images to different vertices in an igraph?
本文介绍了如何在igraph中将不同的图像分配给不同的顶点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我看过这个问题,类似,但是我很难使它与我的数据一起使用.
I've looked at this question which seems similar but I am having difficulty getting it to work with my data.
比方说,我的边缘列表包含以下内容:
Let's say my edgelist consists of the following:
P1 P2 weight
a b 1
a c 3
a d 2
b c 8
我使用read.csv
收集数据,然后将其转换为矩阵.然后使用以下命令对其进行绘制:
I use read.csv
to collect the data, and then I convert it to a matrix. Then I graph it using the following:
g=graph.edgelist(x[,1:2],directed=F)
E(g)$weight=as.numeric(x[,3])
tkplot(g,layout=layout.fruchterman.reingold,edge.width=E(g)$weight)
这将返回具有顶点和边的网络.我想用一个图像替换顶点a,用另一个图像替换顶点b,依此类推.我知道如何将相同的图像应用于所有图像,但是我想将不同的图像应用于每个顶点.我该怎么做呢?
And this returns a network with vertices and edges. I would like to replace vertex a with one image, vertex b with another and so on. I know how to apply the same image to all, but I want to apply a different image to every vertex. How do I go about doing this?
查看全文