Hindhustani Posted February 13, 2023 Report Posted February 13, 2023 I think Below code generates visual graph , how to run the program in Mac? From command line execution it is not giving any visuals, What are the options? import networkx as nx import matplotlib.pyplot as plt G = nx.DiGraph() G.add_node("John") G.add_node("Jane") G.add_node("Jim") G.add_edge("John", "Jane") G.add_edge("John", "Jim") pos = nx.spring_layout(G) nx.draw_networkx_nodes(G, pos, node_color='lightblue', node_size=1000) nx.draw_networkx_labels(G, pos, font_size=20, font_family='sans-serif') nx.draw_networkx_edges(G, pos, edge_color='gray') plt.axis('off') plt.show() Quote
Bendapudi_english Posted February 13, 2023 Report Posted February 13, 2023 25 minutes ago, Hindhustani said: I think Below code generates visual graph , how to run the program in Mac? From command line execution it is not giving any visuals, What are the options? import networkx as nx import matplotlib.pyplot as plt G = nx.DiGraph() G.add_node("John") G.add_node("Jane") G.add_node("Jim") G.add_edge("John", "Jane") G.add_edge("John", "Jim") pos = nx.spring_layout(G) nx.draw_networkx_nodes(G, pos, node_color='lightblue', node_size=1000) nx.draw_networkx_labels(G, pos, font_size=20, font_family='sans-serif') nx.draw_networkx_edges(G, pos, edge_color='gray') plt.axis('off') plt.show() Ask chatgpt anna Quote
Naaperushiva Posted February 13, 2023 Report Posted February 13, 2023 46 minutes ago, Hindhustani said: I think Below code generates visual graph , how to run the program in Mac? From command line execution it is not giving any visuals, What are the options? import networkx as nx import matplotlib.pyplot as plt G = nx.DiGraph() G.add_node("John") G.add_node("Jane") G.add_node("Jim") G.add_edge("John", "Jane") G.add_edge("John", "Jim") pos = nx.spring_layout(G) nx.draw_networkx_nodes(G, pos, node_color='lightblue', node_size=1000) nx.draw_networkx_labels(G, pos, font_size=20, font_family='sans-serif') nx.draw_networkx_edges(G, pos, edge_color='gray') plt.axis('off') plt.show() https://stackoverflow.com/questions/2512225/matplotlib-plots-not-showing-up-in-mac-osx Idhi choodu baa Quote
kasi Posted February 13, 2023 Report Posted February 13, 2023 55 minutes ago, Hindhustani said: I think Below code generates visual graph , how to run the program in Mac? From command line execution it is not giving any visuals, What are the options? import networkx as nx import matplotlib.pyplot as plt G = nx.DiGraph() G.add_node("John") G.add_node("Jane") G.add_node("Jim") G.add_edge("John", "Jane") G.add_edge("John", "Jim") pos = nx.spring_layout(G) nx.draw_networkx_nodes(G, pos, node_color='lightblue', node_size=1000) nx.draw_networkx_labels(G, pos, font_size=20, font_family='sans-serif') nx.draw_networkx_edges(G, pos, edge_color='gray') plt.axis('off') plt.show() Install VSCode n run ur code there Or install Jupiter notebook and run it Google how to do that Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.