title: matplotlib draw() freezes window
body: <p>I am trying to use matplotlib to create a graph to reflect real time results.  I am probably not doing this correctly, because moving the window, changing windows, or clicking things causes the graph to freeze.  Below is an example of what I mean.</p>
  
  <pre><code>import matplotlib
  import matplotlib.pyplot as plt
  from mpl_toolkits.mplot3d import Axes3D
  import numpy as np
  
  def function1(fig, varse):
    ax = fig.add_subplot(111, projection='3d')
    color_grade_classes = ['#80FF00','#FFFF00','#FF8000', '#FF0000']
    varse = varse +1
    ax.set_xlabel('X')
    ax.set_ylabel('Y')
    for colors, rows  in zip(color_grade_classes, [3,2,1,0] ):  
      indexs = np.arange(5)
      heights = [varse,varse/2,varse/3,0,0]
      ax.bar(indexs, heights, zs = rows,  zdir='y', color=colors, alpha=0.8)
    plt.ion()
    plt.draw()
    plt.show()
    plt.ioff()
    return varse
  
  varse = 0
  plt.ion()
  fig = plt.figure()
  plt.ioff()
  while(1):
    varse = function1(fig, varse)
  </code></pre>