title: plt.plot after a keyboard input
body: <p>I'd like to update a plot with different colors with different keypress. But using the following code, the figure only shows in the very end, after pressing 'q'. </p>
  
  <p>Can anyone please give some suggestions? Thanks! </p>
  
  <p>Example:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  b=1
  
  while b:
    a=input('Enter a key: ...')
  
    if a=='b': #plot with blue color if press 'b'
       plt.plot(np.arange(10),color='b')
       plt.draw()
  
    elif a=='r': #plot with red color if press 'r'
       plt.plot(np.arange(10),color='r')
       plt.draw()
  
    elif a=='q':
       b=0
  </code></pre>