我正在尝试使用 GraphPlot
函数构建 Graph
,其中每个节点是一个图像。我想将图像显示为我的顶点。有人知道怎么做这个吗?
我试过这样的事情:
GraphPlot[ Map[If[# > 2.0 , 0, 1] &,
imgDistT, {2}],
VertexRenderingFunction -> (Inset[imgs[[#2]], #1, Center] &) ]
但这不起作用。
imgs 是我与每个顶点编号对应的图像列表。
作为健全性检查,如果我这样做:
GraphPlot[
Map[If[# > 2.0 , 0, 1] &, imgDistT, {2}],
VertexRenderingFunction -> (Inset[Text[#2], #1, Center] &) ]
然后就可以了,它向我显示了每个节点的顶点数。
最佳答案
imgs = ExampleData /@ ExampleData["TestImage"];
GraphPlot[{1 -> 4, 1 -> 5, 2 -> 3, 2 -> 4, 2 -> 5, 3 -> 4, 3 -> 5},
VertexRenderingFunction -> (Inset[Image[imgs[[#2]], ImageSize -> 100], #1] &)]
编辑
-- 删除了中缀符号笑话-
关于graph - Mathematica GraphPlot 与图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/885910/