How to use the hypernetx.drawing.util.get_frozenset_label function in hypernetx

To help you get started, we’ve selected a few hypernetx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pnnl / HyperNetX / hypernetx / drawing / rubber_band.py View on Github external
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,
github pnnl / HyperNetX / hypernetx / drawing / two_column.py View on Github external
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')
github pnnl / HyperNetX / hypernetx / drawing / rubber_band.py View on Github external
**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
github pnnl / HyperNetX / hypernetx / drawing / two_column.py View on Github external
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')