title: ValueError: x and y must have same first dimension
body: <p>I get an error message</p>
  
  <blockquote>
    <p>ValueError: x and y must have same first dimension.</p>
  </blockquote>
  
  <p>Here is the code:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import matplotlib.dates as mdates
  import numpy as np
  
  date,bid,ask = np.loadtxt('GBPUSD1d.txt', unpack=True,
                 delimiter =',',converters={0:mdates.strpdate2num('%Y%m%d%H%M%S')}) 
  avgLine = ((bid+ask)/2)
  patternAr = []
  performanceAr = []
  patForRec = []
  eachPattern = []
  
  def percentChange(startPoint, currentPoint):
          return ((float(currentPoint)- startPoint)/abs(startPoint))*100.00
  
  def patternStorage():
          patStartTime = time.time()
          x = (len(avgLine))-30
          y = 11
          while y &lt; x:
                  pattern = []
                  p1 = percentChange(avgLine[y-10], avgLine[y-9])
                  ...
                  p10 = percentChange(avgLine[y-10], avgLine[y])
  
                  outcomeRange = avgLine[y+20:y+30]
                  currentPoint = avgLine[y]
                  try:
                          avgOutcome = reduce(lambda x, y: x + y, outcomeRange) / len(outcomeRange)
                  except Exception, e:
                          print str(e)
                          avgOutcome = 0
  
                  futureOutcome = percentChange(currentPoint, avgOutcome)
                  pattern.append(p1)
                  pattern.append(p2)
                  pattern.append(p3)
                  pattern.append(p3)
                  pattern.append(p4)
                  pattern.append(p5)
                  pattern.append(p6)
                  pattern.append(p7)
                  pattern.append(p8)
                  pattern.append(p9)
                  pattern.append(p10)
                  patternAr.append(pattern)
                  performanceAr.append(futureOutcome)
                  y += 1
  
          patEndTime = time.time()
          print len (patternAr)
          print len (performanceAr)
          print 'Patten storage took:', patEndTime - patStartTime, 'seconds'
  
  def currentPattern():
      cp1 = percentChange(avgLine[-11], avgLine[-10])
      ...
      cp10 = percentChange(avgLine[-11], avgLine[-1])
      patForRec.append(cp1)
      ...  
      patForRec.append(cp10)
      print patForRec
  
  def patternRecognition():
      for eachPattern in patternAr:
          sim1 = 100.00 - abs(percentChange(eachPattern[0], patForRec[0]))
          ...
          sim10 = 100.00 - abs(percentChange(eachPattern[9], patForRec[9]))
          howSim =((sim1+sim2+sim3+sim4+sim5+sim6+sim7+sim8+sim9+sim10))/float(10)
  
          if howSim &gt; 70:
              patdex = patternAr.index(eachPattern)
              print 'predicted outcome',performanceAr[patdex]
              xp = [1,2,3,4,5,6,7,8,9,10]
              fig = plt.figure()
              plt.plot(xp, patForRec)
              plt.plot(xp, eachPattern)
              plt.show()
  
  patternStorage()
  currentPattern()
  patternRecognition()
  print (len(patForRec))
  print (len(eachPattern))
  </code></pre>
  
  <p>Full error message</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Python27\ANN.py", line 165, in &lt;module&gt;
      patternRecognition()
    File "C:\Python27\ANN.py", line 131, in patternRecognition
      plt.plot(xp, eachPattern)
    File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 3093, in plot
      ret = ax.plot(*args, **kwargs)
    File "C:\Python27\lib\site-packages\matplotlib\axes\_axes.py", line 1373, in plot
      for line in self._get_lines(*args, **kwargs):
    File "C:\Python27\lib\site-packages\matplotlib\axes\_base.py", line 303, in _grab_next_args
      for seg in self._plot_args(remaining, kwargs):
    File "C:\Python27\lib\site-packages\matplotlib\axes\_base.py", line 281, in _plot_args
      x, y = self._xy_from_xy(x, y)
    File "C:\Python27\lib\site-packages\matplotlib\axes\_base.py", line 223, in _xy_from_xy
      raise ValueError("x and y must have same first dimension")
  ValueError: x and y must have same first dimension
  </code></pre>