title: How can I incorporate a slider into my plot to manipulate a variable?
body: <p>I have a plot that is a representation of a sine wave.</p>
  
  <p>In the code, I have the frequency of the sine wave represented as a variable <code>b</code>. I need to be able to change <code>b</code> in real time (i.e. without having to re-run the code after manually changing the value). Ideally, this could be done by using a slider. I tried to use <code>Tkinter</code>'s <code>Slider</code> feature, but was unable to embed the plot in the <code>Tkinter</code> window. </p>
  
  <p>The code that generates the stimulus is as follows:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import matplotlib.cm as cm      
  
  vals = np.linspace(-np.pi,np.pi,100)
  xgrid, ygrid = np.meshgrid(vals,vals)       
  
  b = 5
  the_sine = np.sin(xgrid * b)    
  
  plt.imshow(the_sine)        
  fig = plt.imshow(the_sine, cm.gray)
  plt.axis('off')
  fig.axes.get_xaxis().set_visible(False)
  fig.axes.get_yaxis().set_visible(False)
  
  plt.show()      
  </code></pre>
  
  <p>I can't include an image of the plot, but if you run the code, you'll see how this is a little different than adjusting the parameters of something like a simple line. </p>
  
  <p>Any suggestions?</p>