Making book work in Python 2.7

This commit is contained in:
Roger Labbe
2016-03-06 08:18:27 -08:00
parent f62fb8bbe8
commit fb21cf6313
7 changed files with 213 additions and 189 deletions

View File

@@ -37,7 +37,7 @@ sys.path.insert(0, '..')
def end_interactive(fig):
""" end interaction in a plot created with %matplotlib notebook """
plt.gcf().canvas.draw()
time.sleep(0.2)
time.sleep(1.)
plt.close(fig)
@@ -436,11 +436,11 @@ def set_limits(x, y):
plt.gca().set_xlim(x)
plt.gca().set_ylim(y)
def plot_predictions(p, rng=None):
def plot_predictions(p, rng=None, label='Prediction'):
if rng is None:
rng = range(len(p))
plt.scatter(rng, p, marker='v', s=40, edgecolor='r',
facecolor='None', lw=2, label='prediction')
facecolor='None', lw=2, label=label)