plotnet.py

This commit is contained in:
0xFugue
2023-08-10 22:21:43 +05:30
parent 56baef50b3
commit 42491dc075

View File

@@ -6,6 +6,7 @@ import matplotlib.pyplot as plt
import numpy as np
import sys
def read_network(json_fname, ith=0):
with open(json_fname) as f:
json_graphs, G = json.load(f), nx.empty_graph()
@@ -19,6 +20,7 @@ def read_network(json_fname, ith=0):
G.add_edge(src, dst)
return G
def plot_network(G, fanout):
fig, axes = plt.subplots(1, 2, layout='constrained')
fig.set_figwidth(12)
@@ -51,7 +53,6 @@ def plot_network(G, fanout):
plt.show()
def main(ctx: typer.Context,
network_data_file: Path = typer.Option("observed_network.json",
exists=True, file_okay=True, dir_okay=False, readable=True,
@@ -62,6 +63,5 @@ def main(ctx: typer.Context,
plot_network(G, fanout)
if __name__ == "__main__":
typer.run(main)