title: Plotting vector fields with two different methods (quiver / streamplot) resulting in plots that don't match - Matplotlib
body: <p>I'm trying to plot some vector flows in Python, using <strong>Matplotlib</strong> and I'm having some trouble...</p>
  
  <p>I'm trying to compare two methods, the <a href="http://matplotlib.org/api/pyplot_api.html?highlight=quiver" rel="nofollow noreferrer"><strong>quiver</strong></a> and the <a href="http://matplotlib.org/api/pyplot_api.html?highlight=streamplot" rel="nofollow noreferrer"><strong>streamplot()</strong></a>. I've already read both documentations, but I wasn't able to get the same results for both. </p>
  
  <p>I'm plotting the vectors with these two methods:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy
  
  def plot_quiver(x_dim, y_dim, steps, vector_field_x, vector_field_y, file_path):
      plt.figure()
  
      x, y = numpy.mgrid[-x_dim/2:x_dim/2:steps*1j, -y_dim/2:y_dim/2:steps*1j]
  
      plt.quiver(x, y, vector_field_x, vector_field_y)
  
      plt.savefig(file_path + '.png')
      plt.close()
  
  
  def plot_streamlines(file_path, x_dim, y_dim, steps, vector_field_x, vector_field_y, scalar_field=None):
      plt.figure()
  
      y, x = numpy.mgrid[-x_dim/2:x_dim/2:steps*1j, -y_dim/2:y_dim/2:steps*1j]
  
      plt.figure()
  
      if scalar_field is not None:
          cs = plt.contour(x, y, scalar_field, extent=[-x_dim/2.0, x_dim/2.0, -y_dim/2.0, y_dim/2.0])
          plt.clabel(cs, inline=1, fontsize=10)
  
      # x, y : 1d arrays, an evenly spaced grid.
      # u, v : 2d arrays
      # x and y-velocities. Number of rows should match length of y, and the number of columns should match x.
      plt.streamplot(x, y, vector_field_x, vector_field_y, cmap=plt.cm.autumn)
  
      plt.savefig(file_path + '.png')
      plt.close()
  </code></pre>
  
  <p>However, I just don't know how to get both plots "equal". </p>
  
  <p>The first method plots this image (which is what I was expecting):</p>
  
  <p><img src="https://i.stack.imgur.com/LMoCS.png" alt="enter image description here"></p>
  
  <p>And the second one gives me this:</p>
  
  <p><img src="https://i.stack.imgur.com/e33w4.png" alt="enter image description here"></p>
  
  <p>I don't know what I have to do so they match. I tried every possible combination and got nothing...</p>
  
  <p>And I really need both visualizations.</p>
  
  <p>Any help would be appreciated.
  Thank you in advance.</p>