packages = ["numpy", "matplotlib", "networkx"]
REPL
Hit play button or shift-enter to run code.
pyscript.write('output', '', append=True)
pyscript.write('output1', '', append=False)
pyscript.write('output2', '', append=False)
import networkx as nx
G = nx.DiGraph()
nodes = list(range(4))
G.add_edges_from(zip(nodes[0:-1], nodes[1:]))
pyscript.write('output0', G.edges())
import matplotlib.pyplot as plt
fig = plt.figure()
nx.draw(G, ax=plt.gca(), with_labels=True)
pyscript.write('output0', fig, append=True)
import networkx as nx
G = nx.DiGraph()
nodes = list(range(4))
G.add_edges_from(zip(nodes[0:-1], nodes[1:]))
pyscript.write('output0', G.edges())
import matplotlib.pyplot as plt
fig = plt.figure()
nx.draw(G, ax=plt.gca(), with_labels=True)
pyscript.write('output0', fig, append=True)
output0