def plot_g_h_results(measurements, filtered_data, title='', z_label='Measurements', **kwargs): book_plots.plot_filter(filtered_data, **kwargs) book_plots.plot_measurements(measurements, label=z_label) book_plots.show_legend() plt.title(title) plt.gca().set_xlim(left=0,right=len(measurements))
def plot_dog_track(xs, measurement_var, process_var): N = len(xs) bp.plot_track([0, N-1], [1, N]) bp.plot_measurements(xs, label='Sensor') bp.set_labels('variance = {}, process variance = {}'.format( measurement_var, process_var), 'time', 'pos') plt.ylim([0, N]) bp.show_legend() plt.show()
def plot_gh_results(weights, estimates, predictions): n = len(weights) xs = list(range(n+1)) book_plots.plot_filter(xs, estimates, marker='o') book_plots.plot_measurements(xs[1:], weights, color='k', label='Scale', lines=False) book_plots.plot_track([0, n], [160, 160+n], c='k', label='Actual Weight') book_plots.plot_track(xs[1:], predictions, c='r', label='Predictions', marker='v') book_plots.show_legend() book_plots.set_labels(x='day', y='weight (lbs)') plt.xlim([0, n]) plt.show()
def plot_g_h_results( measurements, filtered_data, title='', z_label='Scale', ): book_plots.plot_measurements(measurements, label=z_label) book_plots.plot_filter(filtered_data) book_plots.show_legend() plt.title(title) plt.gca().set_xlim(left=0, right=len(measurements)) plt.show()
def plot_hypothesis4(): weights = [158.0, 164.2, 160.3, 159.9, 162.1, 164.6, 169.6, 167.4, 166.4, 171.0, 171.2, 172.6] ave = np.sum(weights) / len(weights) plt.errorbar(range(1,13), weights, label='weights', yerr=6, fmt='o', capthick=2, capsize=10) plt.plot([1, 12], [ave,ave], c='r', label='hypothesis') plt.xlim(0, 13); plt.ylim(145, 185) plt.xlabel('day') plt.ylabel('weight (lbs)') book_plots.show_legend() plt.show()
def plot_hypothesis5(): weights = [158.0, 164.2, 160.3, 159.9, 162.1, 164.6, 169.6, 167.4, 166.4, 171.0, 171.2, 172.6] xs = range(1, len(weights)+1) line = np.poly1d(np.polyfit(xs, weights, 1)) plt.errorbar(range(1, 13), weights, label='weights', yerr=5, fmt='o', capthick=2, capsize=10) plt.plot (xs, line(xs), c='r', label='hypothesis') plt.xlim(0, 13); plt.ylim(145, 185) plt.xlabel('day') plt.ylabel('weight (lbs)') book_plots.show_legend() plt.show()
def plot_gh_results(weights, estimates, predictions): n = len(weights) xs = list(range(n + 1)) book_plots.plot_filter(xs, estimates, marker='o') book_plots.plot_measurements(xs[1:], weights, color='k', label='Scale', lines=False) book_plots.plot_track([0, n], [160, 160 + n], c='k', label='Actual Weight') book_plots.plot_track(xs[1:], predictions, c='r', label='Predictions', marker='v') book_plots.show_legend() book_plots.set_labels(x='day', y='weight (lbs)') plt.xlim([0, n]) plt.show()
def plot_hypothesis4(): weights = [ 158.0, 164.2, 160.3, 159.9, 162.1, 164.6, 169.6, 167.4, 166.4, 171.0, 171.2, 172.6 ] ave = np.sum(weights) / len(weights) plt.errorbar(range(1, 13), weights, label='weights', yerr=6, fmt='o', capthick=2, capsize=10) plt.plot([1, 12], [ave, ave], c='r', label='hypothesis') plt.xlim(0, 13) plt.ylim(145, 185) plt.xlabel('day') plt.ylabel('weight (lbs)') book_plots.show_legend() plt.show()
def plot_hypothesis5(): weights = [ 158.0, 164.2, 160.3, 159.9, 162.1, 164.6, 169.6, 167.4, 166.4, 171.0, 171.2, 172.6 ] xs = range(1, len(weights) + 1) line = np.poly1d(np.polyfit(xs, weights, 1)) plt.errorbar(range(1, 13), weights, label='weights', yerr=5, fmt='o', capthick=2, capsize=10) plt.plot(xs, line(xs), c='r', label='hypothesis') plt.xlim(0, 13) plt.ylim(145, 185) plt.xlabel('day') plt.ylabel('weight (lbs)') book_plots.show_legend() plt.show()