title: Python 2.7 NameError: name 'ax1' is not defined
body: <p>I have Python 2.7 Win 32 and have installed Matplotlib, Numpy, PyParsing, Dateutil. In IDLE I place in the following code:</p>
  
  <pre><code>import matplotlib
  import matplotlib.pyplot as plt
  import matplotlib.ticker as mticker
  import matplotlib.dates as mdates
  import numpy as np
  
  def graphRawFX () :
      date=mdates.strpdate2num('%Y%m%d%H%M%S')
      bid, ask = np.loadtxt('GPBUSD1d.txt', unpack=True)
      delimiter=',',
      converters={0:mdates.strpdate2num('%Y%m%d%H%M%S') }
      fig = plt.figure(figsize=(10,7))
      ax1 = plt.subplot2grid((40,40), (0,0), rowspan=40, colspan=40)
  
      ax1.plot(date,bid)
      ax1.plot(date,ask)
  
  ax1.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d %H:%M:%S'))
  
  plt.grid(True)
  plt.show()
  </code></pre>
  
  <p>Running the code results in to the following:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/Emanuel/Desktop/test.py", line 18, in &lt;module&gt;
      ax1.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d %H:%M:%S'))
  NameError: name 'ax1' is not defined
  </code></pre>
  
  <p>Any suggestion to editing the code would be helpful.</p>