Skip to content

Commit c47668e

Browse files
committed
Issue #343
Measurements were being plotted off by one (day 0 instead of the correct day 1).
1 parent 2126f9e commit c47668e

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

01-g-h-filter.ipynb

Lines changed: 11 additions & 11 deletions
Large diffs are not rendered by default.

kf_book/gh_internal.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def plot_hypothesis2():
4848
plt.errorbar(range(1, 11), [169, 170, 169,171, 170, 171, 169, 170, 169, 170],
4949
xerr=0, yerr=6, fmt='bo', capthick=2, capsize=10)
5050
plt.plot([1, 10], [169, 170.5], color='g', ls='--')
51-
51+
5252
plt.xlim(0, 11)
5353
plt.ylim(150, 185)
5454
plt.xlabel('day')
@@ -89,7 +89,7 @@ def plot_hypothesis4():
8989
book_plots.show_legend()
9090
plt.grid(False)
9191

92-
92+
9393
def plot_hypothesis5():
9494
weights = [158.0, 164.2, 160.3, 159.9, 162.1, 164.6,
9595
169.6, 167.4, 166.4, 171.0, 171.2, 172.6]
@@ -108,8 +108,8 @@ def plot_hypothesis5():
108108
plt.ylabel('weight (lbs)')
109109
book_plots.show_legend()
110110
plt.grid(False)
111-
112-
111+
112+
113113
def plot_estimate_chart_1():
114114
with figsize(y=2.5):
115115
plt.figure()
@@ -179,7 +179,7 @@ def plot_gh_results(weights, estimates, predictions, actual, time_step=0):
179179
else:
180180
rng = range(n, n+1)
181181
xs = range(n+1)
182-
book_plots.plot_measurements(weights, color='k', lines=False)
182+
book_plots.plot_measurements(range(1, len(weights)+1), weights, color='k', lines=False)
183183
book_plots.plot_filter(xs, estimates, marker='o', label='Estimates')
184184
book_plots.plot_track(xs[1:], predictions, c='r', marker='v', label='Predictions')
185185
plt.plot([xs[0], xs[-1]], actual, c='k', lw=1, label='Actual')

0 commit comments

Comments
 (0)