Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for v in H.nodes}
# for convenience, we are using setdefault to mutate the argument
# however, we need to copy this to prevent side-effects
edges_kwargs = edges_kwargs.copy()
edges_kwargs.setdefault('edgecolors', plt.cm.tab10(np.arange(len(H.edges))%10))
edges_kwargs.setdefault('facecolors', 'none')
polys = draw_hyper_edges(H, pos,
node_radius=node_radius,
ax=ax,
**edges_kwargs
)
if with_edge_labels:
labels = get_frozenset_label(H.edges, with_edge_counts)
draw_hyper_edge_labels(H, polys,
color=edges_kwargs['edgecolors'],
backgroundcolor=(1, 1, 1, label_alpha),
labels=labels,
ax=ax,
**edge_labels_kwargs
)
if with_node_labels:
labels = get_frozenset_label(H.nodes, with_node_counts)
draw_hyper_labels(H, pos,
node_radius=node_radius,
labels=labels,
ax=ax,
keyword arguments to pass to matplotlib.LineCollection
ax: Axis
matplotlib axis on which the plot is rendered
'''
edge_kwargs = edge_kwargs or {}
ax = ax or plt.gca()
pos = layout_two_column(H)
V = [v.uid for v in H.nodes()]
E = [e.uid for e in H.edges()]
labels = {}
labels.update(get_frozenset_label(V, count=with_node_counts))
labels.update(get_frozenset_label(E, count=with_edge_counts))
if with_color:
edge_kwargs['color'] = {e.uid: plt.cm.tab10(i%10)
for i, e in enumerate(H.edges())}
draw_hyper_edges(H, pos, ax=ax, **edge_kwargs)
draw_hyper_labels(H, pos, labels,
ax=ax,
with_node_labels=with_node_labels,
with_edge_labels=with_edge_labels)
ax.autoscale_view()
ax.axis('off')
**edges_kwargs
)
if with_edge_labels:
labels = get_frozenset_label(H.edges, with_edge_counts)
draw_hyper_edge_labels(H, polys,
color=edges_kwargs['edgecolors'],
backgroundcolor=(1, 1, 1, label_alpha),
labels=labels,
ax=ax,
**edge_labels_kwargs
)
if with_node_labels:
labels = get_frozenset_label(H.nodes, with_node_counts)
draw_hyper_labels(H, pos,
node_radius=node_radius,
labels=labels,
ax=ax,
va='center',
xytext=(5, 0),
textcoords='offset points',
backgroundcolor=(1, 1, 1, label_alpha),
**node_labels_kwargs
)
draw_hyper_nodes(H, pos,
node_radius=node_radius,
ax=ax,
**nodes_kwargs
ax: Axis
matplotlib axis on which the plot is rendered
'''
edge_kwargs = edge_kwargs or {}
ax = ax or plt.gca()
pos = layout_two_column(H)
V = [v.uid for v in H.nodes()]
E = [e.uid for e in H.edges()]
labels = {}
labels.update(get_frozenset_label(V, count=with_node_counts))
labels.update(get_frozenset_label(E, count=with_edge_counts))
if with_color:
edge_kwargs['color'] = {e.uid: plt.cm.tab10(i%10)
for i, e in enumerate(H.edges())}
draw_hyper_edges(H, pos, ax=ax, **edge_kwargs)
draw_hyper_labels(H, pos, labels,
ax=ax,
with_node_labels=with_node_labels,
with_edge_labels=with_edge_labels)
ax.autoscale_view()
ax.axis('off')