ymin, ymax = -0.8, 1.25 fig, axes = plt.subplots(1, 2, figsize=(8, 3)) for ax in axes: ax.grid(alpha=0.4) ax = axes[0] ax.set_ylim(ymin, ymax) ax.set_ylabel(r'$y_t$', fontsize=16) ax.vlines((T, ), -1.5, 1.5) ax.set_xticks((T, )) ax.set_xticklabels((r'$T$', )) sample = [] for i in range(20): rcolor = random.choice(('c', 'g', 'b', 'k')) x, y = ar.simulate(ts_length=T + 15) y = y.flatten() ax.plot(y, color=rcolor, lw=1, alpha=0.5) ax.plot((T, ), (y[T], ), 'ko', alpha=0.5) sample.append(y[T]) y = y.flatten() axes[1].set_ylim(ymin, ymax) axes[1].hist(sample, bins=16, normed=True, orientation='horizontal', alpha=0.5) plt.show()
ymin, ymax = -0.8, 1.25 fig, axes = plt.subplots(1, 2, figsize=(8, 3)) for ax in axes: ax.grid(alpha=0.4) ax = axes[0] ax.set_ylim(ymin, ymax) ax.set_ylabel(r'$y_t$', fontsize=16) ax.vlines((T,), -1.5, 1.5) ax.set_xticks((T,)) ax.set_xticklabels((r'$T$',)) sample = [] for i in range(20): rcolor = random.choice(('c', 'g', 'b', 'k')) x, y = ar.simulate(ts_length=T+15) y = y.flatten() ax.plot(y, color=rcolor, lw=1, alpha=0.5) ax.plot((T,), (y[T],), 'ko', alpha=0.5) sample.append(y[T]) y = y.flatten() axes[1].set_ylim(ymin, ymax) axes[1].hist(sample, bins=16, normed=True, orientation='horizontal', alpha=0.5) plt.show()