I'm following an example from a textbook covering Matplotlib. The following code saves a graph when run through command-line Python, but when ran through Jupyter it saves an empty image. Why is that happening?
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
fig = plt.figure()
plt.plot(x, np.sin(x), '-')
plt.plot(x, np.cos(x), '--')
fig.savefig('image.png')