title: speed up plotting images in matplotlib
body: <p>I wrote some Python in the Spyder IDE to plot a pair of images side by side so I can visually inspect them.  I only need 3 seconds to look at them most of the time but every once in a while I need longer to take a closer look.  Therefore, I didn't use time.sleep, instead I coded it to wait for me to hit the Enter key as below:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import os
  
  def VI_segmentation():
      root = os.getcwd()
      NR_dir = root + '\\Neurite_Results\\'
      SO_dir = root + '\\Segmentation_Overlays\\'
      jpgs = os.listdir(NR_dir)
      fig = plt.figure(figsize=(20,12))
      for jpg in jpgs:
          fig.suptitle(jpg , fontsize=14, fontweight='bold')
          image_NR = plt.imread(NR_dir + jpg)
          image_SO = plt.imread(SO_dir + jpg)
          plt.subplot(121)
          plt.imshow(image_NR)
          plt.subplot(122)
          plt.imshow(image_SO)
          plt.draw()
          plt.pause(0.01)
  
          input('Press Enter to continue')
  
  VI_segmentation()
  </code></pre>
  
  <p>The problem is that I'm thinking faster than my computer :).  It takes the 5 or 6 seconds for the computer to become responsive to the Enter key and another few seconds to update after it responds.  Makes for lousy ergonomics when cranking through hundreds of images that are mostly fine.  Any ideas to streamline this code would be much appreciated.</p>