ScottishCovidResponse / SCRCIssueTracking

Central issue tracking repository for all repos in the consortium
6 stars 0 forks source link

Include code to generate network diagram in repository? #252

Open bobturneruk opened 4 years ago

bobturneruk commented 4 years ago

@magicicada - please append example code to this issue if time allows.

https://github.com/ScottishCovidResponse/simple_network_sim/blob/master/assets/sampleNetwork.png

github-actions[bot] commented 4 years ago

Heads up @magicicada @bobturneruk @aflag - the "Simple Network Sim" label was applied to this issue.

anthonyohare commented 4 years ago

Perhaps not quite what @bobturneruk has in mind (or @magicicada used) but the following code works when inserted after the network is created in sampleUseofModel.py (line 37). It will need networkx to be imported.

# save the movement graph, currently there are no coordinates for the nodes so the laout
# of the graph is random.
plt.figure(figsize=(8, 6))
nx.draw_networkx(network.graph, with_labels=False)
for pos in ['right', 'top', 'bottom', 'left']:
    plt.gca().spines[pos].set_visible(False)
plt.savefig("_network.".join(args.output.rsplit(".", 1)))
plt.close()

Happy to add it to the repo if accepted.

bobturneruk commented 4 years ago

Thanks for this @anthonyohare - ultimately all of the SCRC visualisation will be handled by a separate visualisation team. However, I think this plot might be a useful thing to generate to help with developing the model and to show other teams in SCRC what we are doing. What do you think @magicicada?