new = (('AXIN', 37, REPORTED),
('LGR', 34, REPORTED),
('NKD', 29, REPORTED),
('TNFRSF', 23, REPORTED),
('APCDD', 18, REPORTED),
('TOX', 15, UNREPORTED),
('LEF', 14, REPORTED),
('PLCB', 13, REPORTED),
('MME', 13, UNREPORTED),
('NOTUM', 13,UN REPORTED),
('GNG', 11, , REPORTED),
('LOXL', 10, UNREPORTED))
import matplotlib.pyplot as plt
import networkx as nx
children = sorted(new, key=lambda x: x[1])
parent = children.pop()[0]
G = nx.Graph()
for child, weight in children: G.add_edge(parent, child, weight=weight)
width = list(nx.get_edge_attributes(G, 'weight').values())
plt.savefig("plt.gene-expression.pdf")
plt.figure(figsize = (20, 10))
nx.draw_networkx(G, font_size=10, node_size=2000, alpha=0.6) #width=width is very fat lines
plt.savefig("gene-expression-graph.pdf")
このnxグラフでは、どのようにして未登録 - 緑色、REPORTED-黄色にすることができますか? 親ノードが最大数、すなわち、AXINのノード、37python networkX:タプルからグラフを作成し、ノードに異なる色を割り当てる
必須ではないが、次の同じコードを実行するとaxinが黄色のノードとして表示されます。 –
@Bonlenfum 皆さん、どうやってこのnx質問を解決できるか教えてください。 http://stackoverflow.com/questions/43090538/draw-common-friends-connections-of-three-people-using-networkx –