Draw resulting clusters.
(
ax,
G,
ws,
edge_color=(0.22, 0.22, 0.22, 0.4),
node_size=40,
edge_width=0.5,
pastel_factor=0.7,
**kwargs,
)
| 29 | |
| 30 | |
| 31 | def draw_clusters( |
| 32 | ax, |
| 33 | G, |
| 34 | ws, |
| 35 | edge_color=(0.22, 0.22, 0.22, 0.4), |
| 36 | node_size=40, |
| 37 | edge_width=0.5, |
| 38 | pastel_factor=0.7, |
| 39 | **kwargs, |
| 40 | ): |
| 41 | """Draw resulting clusters.""" |
| 42 | pos = {x: G.nodes[x]["position"][:2] for x in G} |
| 43 | # make colormap indexed by cluster id |
| 44 | cmap = distinctipy.get_colors(ws.num_clusters, pastel_factor=pastel_factor) |
| 45 | cmap_lookup = {x: cmap[i] for i, x in ws.cluster_ids.items()} |
| 46 | # assign colors by looking up cluster id for each node |
| 47 | cluster_map = ws.cluster_map |
| 48 | colors = [cmap_lookup[cluster_map[x]] for x in G] |
| 49 | # draw the graph |
| 50 | nx.draw_networkx_edges(G, pos, edge_color=edge_color, width=edge_width, ax=ax) |
| 51 | nx.draw_networkx_nodes( |
| 52 | G, pos, node_color=colors, node_size=node_size, ax=ax, **kwargs |
| 53 | ) |
| 54 | ax.set_aspect("equal") |
| 55 | |
| 56 | |
| 57 | def draw_task_clusters( |
nothing calls this directly
no outgoing calls
no test coverage detected