@@ -241,7 +241,7 @@ for i, ϕ in enumerate((0.8, -0.8)):
241241 times = list(range(16))
242242 acov = [ϕ**k / (1 - ϕ**2) for k in times]
243243 ax.plot(times, acov, 'bo-', alpha=0.6,
244- label=f 'autocovariance, $\phi = {ϕ:.2}$')
244+ label=fr 'autocovariance, $\phi = {ϕ:.2}$')
245245 ax.legend(loc='upper right')
246246 ax.set(xlabel='time', xlim=(0, 15))
247247 ax.hlines(0, 0, 15, linestyle='--', alpha=0.5)
@@ -479,7 +479,7 @@ for i, ϕ in enumerate((0.8, -0.8)):
479479 ax = axes[i]
480480 sd = ar1_sd(ϕ, ωs)
481481 ax.plot(ωs, sd, 'b-', alpha=0.6, lw=2,
482- label='spectral density, $\phi = {ϕ:.2}$')
482+ label=fr 'spectral density, $\phi = {ϕ:.2}$')
483483 ax.legend(loc='upper center')
484484 ax.set(xlabel='frequency', xlim=(0, np.pi))
485485plt.show()
@@ -525,21 +525,21 @@ plt.subplots_adjust(hspace=0.25)
525525
526526# Autocovariance when ϕ = -0.8
527527ax = axes[0]
528- ax.plot(times, y1, 'bo-', alpha=0.6, label='$\gamma(k)$')
528+ ax.plot(times, y1, 'bo-', alpha=0.6, label=r '$\gamma(k)$')
529529ax.legend(loc='upper right')
530530ax.set(xlim=(0, 15), yticks=(-2, 0, 2))
531531ax.hlines(0, 0, 15, linestyle='--', alpha=0.5)
532532
533533# Cycles at frequency π
534534ax = axes[1]
535- ax.plot(times, y2, 'bo-', alpha=0.6, label='$\cos(\pi k)$')
535+ ax.plot(times, y2, 'bo-', alpha=0.6, label=r '$\cos(\pi k)$')
536536ax.legend(loc='upper right')
537537ax.set(xlim=(0, 15), yticks=(-1, 0, 1))
538538ax.hlines(0, 0, 15, linestyle='--', alpha=0.5)
539539
540540# Product
541541ax = axes[2]
542- ax.stem(times, y3, label='$\gamma(k) \cos(\pi k)$')
542+ ax.stem(times, y3, label=r '$\gamma(k) \cos(\pi k)$')
543543ax.legend(loc='upper right')
544544ax.set(xlim=(0, 15), ylim=(-3, 3), yticks=(-1, 0, 1, 2, 3))
545545ax.hlines(0, 0, 15, linestyle='--', alpha=0.5)
@@ -565,21 +565,21 @@ plt.subplots_adjust(hspace=0.25)
565565
566566# Autocovariance when phi = -0.8
567567ax = axes[0]
568- ax.plot(times, y1, 'bo-', alpha=0.6, label='$\gamma(k)$')
568+ ax.plot(times, y1, 'bo-', alpha=0.6, label=r '$\gamma(k)$')
569569ax.legend(loc='upper right')
570570ax.set(xlim=(0, 15), yticks=(-2, 0, 2))
571571ax.hlines(0, 0, 15, linestyle='--', alpha=0.5)
572572
573573# Cycles at frequency π
574574ax = axes[1]
575- ax.plot(times, y2, 'bo-', alpha=0.6, label='$\cos(\pi k/3)$')
575+ ax.plot(times, y2, 'bo-', alpha=0.6, label=r '$\cos(\pi k/3)$')
576576ax.legend(loc='upper right')
577577ax.set(xlim=(0, 15), yticks=(-1, 0, 1))
578578ax.hlines(0, 0, 15, linestyle='--', alpha=0.5)
579579
580580# Product
581581ax = axes[2]
582- ax.stem(times, y3, label='$\gamma(k) \cos(\pi k/3)$')
582+ ax.stem(times, y3, label=r '$\gamma(k) \cos(\pi k/3)$')
583583ax.legend(loc='upper right')
584584ax.set(xlim=(0, 15), ylim=(-3, 3), yticks=(-1, 0, 1, 2, 3))
585585ax.hlines(0, 0, 15, linestyle='--', alpha=0.5)
0 commit comments