我正在创建一个以图像为节点的图表,
# 图像来源于http://matplotlib.sourceforge.net/users/image_tutorial.html
我想创建一个圆形布局,其中节点zero
位于中心位置。Egdelist 是 [(0,1),(0,2),(0,3),(0,4),(0,5)]
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import networkx as nx
img=mpimg.imread('stinkbug.png')
G=nx.complete_graph(6)
G.node[0]['image']=img
G.node[1]['image']=img
G.node[2]['image']=img
G.node[3]['image']=img
G.node[4]['image']=img
G.node[5]['image']=img
print(G.nodes())
G.add_edge(0,1)
G.add_edge(0,2)
G.add_edge(0,3)
G.add_edge(0,4)
G.add_edge(0,5)
print(G.edges())
nx.draw_circular(G)
但是,在输出中我发现了额外的边缘(附上快照)。有没有办法去除这些额外的边缘?我只想要这些连接,例如Egdelist是[(0,1),(0,2),(0,3),(0,4),(0,5)]。另外,原始图像在节点中没有显示。
任何建议吗?
trans=ax.transData.transform
trans2=fig.transFigure.inverted().transform
- Natasha