How to use the nxviz.base.BasePlot.__init__ function in nxviz

To help you get started, we’ve selected a few nxviz 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 ericmjl / nxviz / nxviz / hive.py View on Github external
def __init__(self, nodes, edges,
                 nodecolors='blue', edgecolors='black',
                 nodeprops=dict(radius=0.2), edgeprops=dict(alpha=0.5),
                 figsize=(8, 8)):
        # Initialize using BasePlot
        BasePlot.__init__(self, nodes, edges)

        # The following method calls are specific to HivePlot.
        # 1. Set the .nodes attribute, but first do type checking.
        self.set_nodes(nodes)
        # 2. Set the major and minor angle attributes.
        self.set_major_angle()
        self.set_minor_angle()
        # 3. Set the nodecolors attributes.
        self.set_nodecolors(nodecolors)
        # 4. Compute node positions.
        self.compute_node_positions()
        # 5. Set the aspect ratio of the plot to be equal.
        self.ax.set_aspect('equal')
        # 6. Set the xlim and ylim of the plot.
        # Change the following two lines to an automatic function that computes
        # the appropriate x- and y- limits from the number of nodes in each
github ericmjl / nxviz / nxviz / circos.py View on Github external
def __init__(self, nodes, edges, plot_radius,
                 nodecolors='blue', edgecolors='black',
                 nodeprops=dict(radius=0.3), edgeprops=dict(alpha=0.5),
                 figsize=(8, 8)):
        # Initialize using BasePlot
        BasePlot.__init__(self, nodes, edges)
        # The following attributes are specific to CircosPlot
        self.plot_radius = plot_radius
        # The rest of the relevant attributes are inherited from BasePlot.
        self.compute_node_positions()
        self.ax.set_xlim(-radius*1.2, radius*1.2)
        self.ax.set_ylim(-radius*1.2, radius*1.2)
        self.ax.xaxis.set_visible(False)
        self.ax.yaxis.set_visible(False)
        self.ax.set_aspect('equal')