title: Matplotlib: TypeError: 'AxesSubplot' object is not callable
body: <p>I am new to programming so please pardon me if this is a rookie mistake. </p>
  
  <p>I am writing this python script where I have defined functions that create subplots of distributions.</p>
  
  <p>I have a slider widget for the end user to change value of variables(mu and sigma) and see the effect on distribution. Here's my code</p>
  
  <pre><code>import numpy as np
  print np.__version__
  import scipy
  print scipy.__version__
  from scipy.stats import norm, lognorm, uniform
  import matplotlib
  print matplotlib.__version__
  import matplotlib.pyplot as plt
  from matplotlib.widgets import Slider, Button, RadioButtons, CheckButtons
  
  
  
  #####Calculating mean and standard deviation#####
  
  global mu_a1
  mu_a1 = 1
  global mu_b1
  mu_b1 = 10
  global mu_c1
  mu_c1 = -13
  global sigma_a1
  sigma_a1 =  0.14
  global sigma_b1
  sigma_b1 =  1.16
  global sigma_c1
  sigma_c1 =  2.87
  mu_x01 = -11
  sigma_x01 =  1.9
  
  #####_____#####
  
  
  
  #####Generating random data#####
  
  a1 = 0.75*mu_a1 + (1.25 - 0.75)*sigma_a1*np.random.sample(10000)
  b1 = 8*mu_b1 + (12 - 8)*sigma_b1*np.random.sample(10000)
  c1 = -12*mu_c1 + 2*sigma_c1*np.random.sample(10000)
  x01 = (-b1 - np.sqrt(b1**2 - (4*a1*c1)))/(2*a1)
  
  #####_____#####
  
  
  
  #######Creating subplots &amp; plotting distributions#####
  
  fig = plt.figure()
  plt.subplots_adjust(left=0.13,right=0.99,bottom=0.05)
  
  def ax1():
      ax1 = fig.add_subplot(331)
      ax1.clear()
      ax1.set_xlabel('a' , fontsize = 14)
      ax1.grid(True)
      [n1,bins1,patches] = ax1.hist(a1, bins=50, color = 'red',alpha = 0.5, normed = True)
      return ax1
  
  def ax2():
      ax2 = fig.add_subplot(334)
      ax2.clear()
      ax2.set_xlabel('b' , fontsize = 14)
      ax2.grid(True)
      [n2,bins2,patches] = ax2.hist(b1, bins=50, color = 'red',alpha = 0.5, normed = True)
      return ax2
  
  def ax3():
      ax3 = fig.add_subplot(337)
      ax3.clear()
      ax3.set_xlabel('c' , fontsize = 14)
      ax3.grid(True)
      [n3,bins3,patches] = ax3.hist(c1, bins=50, color = 'red',alpha = 0.5, normed = True)
      return ax3
  
  def ax4_ax5():
      ax4 = fig.add_subplot(132)
      ax4.clear()
      ax4.set_xlabel('x0' , fontsize = 14)
      ax4.grid(True)
      [n4,bins4,patches] = ax4.hist(x01, bins=50, color = 'red',alpha = 0.5, normed = True)
      ax4.axvline(np.mean(x01), color = 'black', linestyle = 'dashed', lw = 2)
  
      ax5 = fig.add_subplot(133)
      ax5.clear()
      ax5.set_xlabel('x0' , fontsize = 14)
      ax5.set_ylabel('CDF', fontsize = 14)
      ax5.grid(True)
      dx = bins4[1] - bins4[0]
      CDF = np.cumsum(n4)*dx
      ax5.plot(bins4[1:], CDF, color = 'red')
      return ax4,ax5
  
  #######_____#####
  
  ax1 = ax1()
  ax2 = ax2()
  ax3 = ax3()
  ax4, ax5 = ax4_ax5()
  
  #####Creating Sliders#####
  
  axcolor = 'lightgoldenrodyellow'
  axmu_331 = plt.axes([0.015, 0.67, 0.07, 0.015], axisbg=axcolor)
  axsigma_331 = plt.axes([0.015, 0.65, 0.07, 0.015], axisbg=axcolor)
  smu_331 = Slider(axmu_331, 'M', -13.0 , 10.0, valinit = 1.0)
  ssigma_331 = Slider(axsigma_331, 'SD', -3.0 , 3.0, valinit =1.0)
  
  #####_____#####
  
  
  
  #####Updating Sliders#####
  
  def update_slider_331(val):
      mu_a1 = smu_331.val
      print mu_a1
      sigma_a1 = ssigma_331.val
      print sigma_a1
      ax1()
      ax4_ax5()
      plt.draw()
  
  smu_331.on_changed(update_slider_331)
  ssigma_331.on_changed(update_slider_331)
  
  #####_____#####
  
  
  plt.show()
  </code></pre>
  
  <p>I would like the distribution to update every time the slider value is changed . However, when I change the slider value, I get this error</p>
  
  <pre><code>  Traceback (most recent call last):
    File "C:\Program Files (x86)\python27\lib\site-packages\matplotlib\backends\backend_qt4.py", line 175, in mousePressEvent
      FigureCanvasBase.button_press_event( self, x, y, button )
    File "C:\Program Files (x86)\python27\lib\site-packages\matplotlib\backend_bases.py", line 1632, in button_press_event
      self.callbacks.process(s, mouseevent)
    File "C:\Program Files (x86)\python27\lib\site-packages\matplotlib\cbook.py", line 262, in process
      proxy(*args, **kwargs)
    File "C:\Program Files (x86)\python27\lib\site-packages\matplotlib\cbook.py", line 192, in __call__
      return mtd(*args, **kwargs)
    File "C:\Program Files (x86)\python27\lib\site-packages\matplotlib\widgets.py", line 315, in _update
      self.set_val(val)
    File "C:\Program Files (x86)\python27\lib\site-packages\matplotlib\widgets.py", line 327, in set_val
      func(val)
    File "H:/UQ&amp;M/GUI Demos/WIP/Stack Overflow_func.py", line 118, in update_slider_331
      ax1()
  TypeError: 'AxesSubplot' object is not callable
  </code></pre>
  
  <p>I also have a mouse click event (not shown in the above code) where I call the 'ax' functions and they work fine. Wondering why they are not working with the slider update function.</p>
  
  <p>Thanks in advance :-)</p>