Create dynamic updated graph with Python

前端 未结 5 1376
情歌与酒
情歌与酒 2021-02-04 19:25

I need your help to write a script in Python that will take dynamically changed data, the source of data is not matter here, and display graph on the screen.

I know how

5条回答
  •  终归单人心
    2021-02-04 19:47

    example of dynamic plot , the secret is to do a pause while plotting , here i use networkx:

        G.add_node(i,)
        G.add_edge(vertic[0],vertic[1],weight=0.2)
        print "ok"
        #pos=nx.random_layout(G)
        #pos = nx.spring_layout(G)
        #pos = nx.circular_layout(G)
        pos = nx.fruchterman_reingold_layout(G)
    
        nx.draw_networkx_nodes(G,pos,node_size=40)
        nx.draw_networkx_edges(G,pos,width=1.0)
        plt.axis('off') # supprimer les axes
    
        plt.pause(0.0001)
        plt.show()  # display
    

提交回复
热议问题