gpt4 book ai didi

graph - Mathematica GraphPlot 与图像

转载 作者:行者123 更新时间:2023-12-05 00:43:36 26 4
gpt4 key购买 nike

我正在尝试使用 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] &)]

enter image description here

编辑

-- 删除了中缀符号笑话-

关于graph - Mathematica GraphPlot 与图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/885910/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com