modules/utils/plotter.py
def network_tip_states(net, x, spatial=False):
    '''The state given of the tipping_network is plotted.
    Tipped tipping elements are red, non-tipped elements are green.'''
    if spatial:
        pos = {}
        for node in net.nodes(data=True):
            pos[node[0]]=node[1]['pos']
    else:
        pos=nx.circular_layout(net)

    tip_state = net.get_tip_states(x)
    color_map = []
    label_dict = {}
    for node in range(net.number_of_nodes()):
        label_dict.update({node: str(node) + ' (' +
                           net.get_node_types()[node] + ')'})
        if tip_state[node]:
            color_map.append('red')
        else:
            color_map.append('green')
    
    nx.draw_networkx(net, pos, node_color=color_map, labels=label_dict,
                     arrows=True, fond_size=10)
    return plt
The state given of the tipping_network is plotted.
    Tipped tipping elements are red, non-tipped elements are green.
The state given of the tipping_network is plotted.
Tipped tipping elements are red, non-tipped elements are green.
The state given of the tipping_network is plotted . Tipped tipping elements are red non - tipped elements are green .
def network_tip_states(net, x, spatial=False):
    if spatial:
        pos = {}
        for node in net.nodes(data=True):
            pos[node[0]]=node[1]['pos']
    else:
        pos=nx.circular_layout(net)
    tip_state = net.get_tip_states(x)
    color_map = []
    label_dict = {}
    for node in range(net.number_of_nodes()):
        label_dict.update({node: str(node) + ' (' +
                           net.get_node_types()[node] + ')'})
        if tip_state[node]:
            color_map.append('red')
        else:
            color_map.append('green')
    nx.draw_networkx(net, pos, node_color=color_map, labels=label_dict,
                     arrows=True, fond_size=10)
    return plt
def network_tip_states ( net , x , spatial = False ) : if spatial : pos = { } for node in net . nodes ( data = True ) : pos [ node [ 0 ] ] = node [ 1 ] [ 'pos' ] else : pos = nx . circular_layout ( net ) tip_state = net . get_tip_states ( x ) color_map = [ ] label_dict = { } for node in range ( net . number_of_nodes ( ) ) : label_dict . update ( { node : str ( node ) + ' (' + net . get_node_types ( ) [ node ] + ')' } ) if tip_state [ node ] : color_map . append ( 'red' ) else : color_map . append ( 'green' ) nx . draw_networkx ( net , pos , node_color = color_map , labels = label_dict , arrows = True , fond_size = 10 ) return plt
The state given of the tipping_network is plotted.
The state given of the tipping_network is plotted .
'''The state given of the tipping_network is plotted.
    Tipped tipping elements are red, non-tipped elements are green.'''
net
x
spatial