title: forming a meshgrid with phi values
body: <p>I need to make an imshow() diagram with each element showing the value of the polar angle phi (starting from the x-axis). I thought of the following code:</p>
  
  <pre><code>x = np.linspace(-3*a,3*a,1000, dtype='complex')
  y = np.linspace(-3*a,3*a,1000, dtype='complex')
  X,Y = np.meshgrid(x,y)
  rho = np.sqrt(X**2+Y**2)
  phi = np.arcsin(Y/rho)
  </code></pre>
  
  <p>The problem with the last line is that if I just naively use arcsin, arccos or arctan, then the sign will be incorrect in some quadrants. I need phi to vary from 0 to 2*pi, or from -pi to +pi, but with the above code, half of all the values will have the sign incorrect.</p>
  
  <p>So how should I do that?</p>