def plot_rates(self, lns=None, axs=None, draw_events=True, data_index=0, T_slice=None, color="#377eb8"):
        import matplotlib.pyplot as plt
        assert len(self.data_list) > data_index
        data = self.data_list[data_index]
        rates = self.compute_rate(data_index)
        S = data.S
        T_slice = T_slice if T_slice is not None else (0,data.T)
        ymax = np.max(S[T_slice[0]:T_slice[1],:])

        if lns is None:
            lns = []
            if axs is None:
                axs = plt.subplots(self.K, 1, sharex=True)
            else:
                assert len(axs) == self.K

            for k in xrange(self.K):
                ln = axs[k].plot(self.dt * np.arange(data.T),
                                 rates[:,k],
                                 color=color, lw=2)

                axs[k].set_ylabel('$\\lambda_{%d}$' % (k+1))
                if k == self.K-1:
                    axs[k].set_xlabel('time $t$')
                else:
                    axs[k].set_xticks([])

                axs[k].set_xlim(T_slice)
                axs[k].set_ylim(0,1.1*ymax)

                lns.append(ln)

            if draw_events:
                for k in xrange(self.K):
                    # Get event times and counts
                    tk = np.nonzero(data.S[:,k])[0]
                    ck = data.S[tk,k]

                    # Stem plot
                    axs[k].stem(tk+self.dt/2., ck, '-k', markerfmt="ko", lw=2)

        else:
            # Update given rate lns
            for k in xrange(self.K):
                lns[k][0].set_data((self.dt * np.arange(data.T), rates[:,k]))

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