【发布时间】:2021-12-11 03:16:13
【问题描述】:
我做了一个图表。在这里,我使用单个值来表示节点大小。我想根据size_of_node列表改变节点大小。
代码:
import matplotlib.pyplot as plt
import networkx as nx
from netgraph import Graph
triangle = nx.DiGraph([('a', 'b'), ('a', 'c'), ('b', 'a')])
size_of_node = [3,1, 4]
edge_labels = {
('a', 'b') : 3,
('a', 'c') : 10,
('b', 'a') : 4
}
fig, (ax1) = plt.subplots(1, figsize=(14,14))
Graph(triangle, node_labels=True, edge_labels=edge_labels,
edge_label_fontdict=dict(size=12, fontweight='bold'),
edge_layout='curved',
node_size=3, edge_width=4, arrows=True, ax=ax1)
plt.show()
如何根据列表更改节点大小?
【问题讨论】:
-
到目前为止你的尝试是什么?
标签: python matplotlib graph