How to use the netgraph._interactive_variants.InteractiveGrid function in netgraph

To help you get started, we’ve selected a few netgraph 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 paulbrodersen / netgraph / netgraph / _interactive_variants.py View on Github external
def demo_InteractiveGrid():
    n = 4
    adj = np.ones((n,n))
    adj = np.triu(adj, 1)
    pos = np.random.rand(n,2)
    pos[:,0] *= 10
    pos[:,1] *= 5
    pos = {ii:xy for ii, xy in enumerate(pos)}

    fig, ax = plt.subplots()
    ax.set(xlim=[0, 10], ylim=[0, 5])
    g = InteractiveGrid(adj, pos, ax=ax, node_size=15.)

    return g
github paulbrodersen / netgraph / netgraph / _interactive_variants.py View on Github external
x, y = self.node_positions[node]
                x = np.int(np.round(x))
                y = np.int(np.round(y))
                self.node_positions[node] = (x, y)

            self._update_nodes(nodes)
            self._update_edges(nodes)

            if self.show_grid:
                self._draw_grid()
            if self.show_tiles:
                self._draw_tiles(color='b', alpha=0.1)

            self.fig.canvas.draw_idle()

        super(InteractiveGrid, self)._on_release(event)