In the early stages of some programming projects, I often like to explore the problem visually: to run a series of simulations with different values of the input parameters and create a series of graphs in order to gain some intuition about the problem. A convenient approach is to embed some plotting commands in a loop. For example, suppose I want to see what the first ten Bessel functions look like. It seems that the following script should do what I want: import numpy as np import matplotlib.pyplot as plt from scipy.special import jn # Import Bessel function. r = np.linspace(0,20,101) for n in range(10): plt.plot(r, jn(n,r)) # Draw nth Bessel function. plt.title("Bessel function J[%d](r)." % n) input("Press <Enter> to continue.") # Wait for user input to continue. plt.cla() # Clear axes for next plot. However, when I run the script, all I see is an empty plot window,