title: Using streamplot function in Python for stretched grid
body: <p>I am trying to plot (magnetic) field lines. I came to know stream function is the tool used to plot field lines. However, an error comes up telling <code>ValueError: 'x' values must be equally spaced</code>.</p>
  <p>Please note that the code uses Fourier basis along x so it is equally spaced along x and uses Chebyshev basis along y and hence it is non-uniform grid along y. I do not understand why the code says &quot;x must be uniformly spaced&quot; when it's uniform along x.</p>
  <p>The other thing I want to know is, how to plot field lines for a non-uniform grid?</p>
  <p>Also is there any other method to plot field lines apart from streamplot?</p>
  <p>Code that I am running is attached below for reference:</p>
  <pre><code>import numpy as np
  import h5py
  import matplotlib.pyplot as plt
  
  f = h5py.File('./B_mm/Re_10k/Bx_v24/Bx_v24_s1.h5', 'r')
  y = f['/scales/y/1.0'][:]
  x = f['/scales/x/1.0'][:]
  Bxtotal = f['/tasks/Bxtotal'][:]
  Bytotal = f['/tasks/Bytotal'][:]
  t = f['scales']['sim_time'][:]
  print(np.shape(y))
  print('y = ', y)
  print(np.shape(x))
  print('x= ', x)
  
  X, Y = np.meshgrid(y,x)
  print(np.shape(X))
  print(np.shape(Y))
  
  Bx = Bxtotal[len(Bxtotal)-1, :, :]
  By = Bytotal[len(Bytotal)-1, :, :]
  print(np.shape(Bx))
  print(np.shape(By))
  
  plt.figure(figsize=(4,4),facecolor=&quot;w&quot;)
  plt.streamplot(X, Y, Bx, By, color='k', density=1.3, minlength=0.9, arrowstyle='-')
  plt.show()
  </code></pre>
  <p>And this is my error message;
  <img src="https://i.stack.imgur.com/Or3ZP.png" alt="Error message" /></p>