def plot_network(self, lns=None, ax=None, rad=10, color="#377eb8"):
        import matplotlib.pyplot as plt

        W_eff = self.W_effective
        ths = np.linspace(0, 2*np.pi, num=self.K, endpoint=False)
        irad = 0.8*rad

        if lns is None:
            if ax is None:
                ax = plt.gca()

            # Hide the x and y axes
            ax.get_xaxis().set_visible(False)
            ax.get_yaxis().set_visible(False)

            # Layout the nodes in a circle
            for k in xrange(self.K):
                ax.text(rad*np.cos(ths[k]), rad*np.sin(ths[k]), "%d" % (k+1))

            ax.set_xlim(-1.25*rad, 1.35*rad)
            ax.set_ylim(-1.25*rad, 1.35*rad)
            ax.set_aspect("equal")

            # Draw lines connecting nodes
            lns = []
            for k1 in xrange(self.K):
                for k2 in xrange(self.K):
                    if k1 == k2:
                        continue

                    ln = ax.arrow(irad*np.cos(ths[k1]), irad*np.sin(ths[k1]),
                                 .8*irad*(np.cos(ths[k2])-np.cos(ths[k1])),
                                 .8*irad*(np.sin(ths[k2])-np.sin(ths[k1])),
                                 width=0.3,
                                 head_width=2.,
                                 color=color,
                                 length_includes_head=True)
                    ln.set_linewidth(3*W_eff[k1,k2])

                    # Arrow is only visible if there is a connection
                    ln.set_visible(self.A[k1,k2])

                    lns.append(ln)

        else:
            # Update given lns
            ind = 0
            for k1 in xrange(self.K):
                for k2 in xrange(self.K):
                    if k1 == k2:
                        continue

                    # Get the corresponding line
                    ln = lns[ind]
                    ind += 1

                    if self.A[k1,k2]:
                        ln.set_linewidth(3*W_eff[k1,k2])
                        ln.set_visible(True)
                    else:
                        ln.set_linewidth(0)
                        ln.set_visible(False)

        return lns
dataset/ETHPy150Open slinderman/pyhawkes/pyhawkes/models.py/_DiscreteTimeNetworkHawkesModelBase.plot_network/original