Skip to content

Commit

Permalink
Merge branch 'main' into gdsfactory8
Browse files Browse the repository at this point in the history
  • Loading branch information
joamatab committed Jun 19, 2024
2 parents 608e49f + e6ed859 commit 864812d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions gplugins/klayout/netlist_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ def netlist_to_networkx(
G.add_edge(device_name, net_name)
all_used_nets.add(net_name)

# Easier to set different colors for nets
for net in all_used_nets:
G.nodes[net]["is_net"] = True

if not include_labels:
for node in all_used_nets:
connections = list(G.neighbors(node))
Expand Down
10 changes: 8 additions & 2 deletions gplugins/klayout/plot_nets.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,21 @@ def _removal_condition(node: str, degree: int) -> bool:
net.from_nx(G_connectivity)
net.show("connectivity.html")
else:
color_nets = [
"lightblue"
if G_connectivity.nodes[node].get("is_net", False)
else "lightpink"
for node in G_connectivity.nodes()
]

fig = plt.figure(figsize=(8, 6))
nx.draw(
G_connectivity,
with_labels=True,
node_size=2000,
node_color="lightpink",
node_color=color_nets,
font_size=12,
)
plt.title("Connectivity")
return fig


Expand Down

0 comments on commit 864812d

Please sign in to comment.