title: Plotting streamlines with Matplotlib - Python
body: <p>I'm trying to plot some streamlines with Matplotlib.</p>
  
  <p>I have this code so far, as an example to plot a <strong>10 x 10</strong> vector field:</p>
  
  <pre><code>def plot_streamlines(file_path, vector_field_x, vector_field_y):
      plt.figure()
      y, x = numpy.mgrid[-2:2:10j, -2:2:10j]
      plt.streamplot(x, y, vector_field_x, vector_field_y, color='y', cmap=plt.cm.autumn)
      plt.savefig(file_path + '.png')
      plt.close()
  </code></pre>
  
  <p>This works properly, but if I just change this line:</p>
  
  <pre><code>y, x = numpy.mgrid[-2:2:10j, -2:2:10j]
  </code></pre>
  
  <p>To that one:</p>
  
  <pre><code>x, y = numpy.mgrid[-2:2:10j, -2:2:10j]
  </code></pre>
  
  <p>I get some errors:</p>
  
  <pre><code>Traceback (most recent call last):
    File "Library/Python/2.7/lib/python/site-packages/matplotlib/pyplot.py", line 3224, in streamplot minlength=minlength, transform=transform)
    File "/Library/Python/2.7/lib/python/site-packages/matplotlib/axes.py", line 6861, in streamplot transform=transform)
    File "Library/Python/2.7/lib/python/site-packages/matplotlib/streamplot.py", line 67, in streamplot grid = Grid(x, y)
    File "Library/Python/2.7/lib/python/site-packages/matplotlib/streamplot.py", line 256, in __init__
      assert np.allclose(x_row, x)
  AssertionError
  </code></pre>
  
  <p>I didn't understand how I can use the "standard" order <strong>x / y</strong>, since my mesh grid is squared. Moreover, I don't know how I get these erros if my <strong>x</strong> and <strong>y</strong> dimensions are the same.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Thank you.</p>