Commit 9865fcf8 authored by jay's avatar jay
Browse files

Adds axes arg to the graph view for use in subplots

parent b0278467
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -46,11 +46,11 @@ def plot_graph(graph, ax=None, cmap='Spectral', labels=False, font_size=12, clus
            colors.append(cmap(0)[0])

    pos = nx.spring_layout(graph)
    nx.draw_networkx_nodes(graph, pos)
    nx.draw_networkx_edges(graph, pos)
    nx.draw_networkx_nodes(graph, pos, ax=ax)
    nx.draw_networkx_edges(graph, pos, ax=ax)
    if labels:
        labels = dict((i, d['image_name']) for i, d in graph.nodes_iter(data=True))
        nx.draw_networkx_labels(graph, pos, labels, font_size=font_size)
        nx.draw_networkx_labels(graph, pos, labels, font_size=font_size, ax=ax)
    ax.axis('off')
    return ax