# Inconsistent Vector Plot over Contour Plot

I am trying to plot the gradient vector field over the contour plot of a function. While the demo function seems to work very well with the demo taken from How to use vector plot and gradient vectors? (first plot), I am getting a quite confusing vector plot with my own function (second plot). My gut feeling is that the vector should be orthogonal to the contours like the ones in the first plot.

Am I doing anything wrong here? I tried quitting the kernel and restart a new one to avoid any carry-over effects from my previous environment but no luck.

\[Beta]=0.5; dH =1.5; dL =1; rL = 1;
g[\[Gamma]_,rH_]:=((dL (-1+\[Beta])-dH \[Beta]) (-dH (1+rL) (-1+\[Beta])+dL (1+rH) \[Beta] (1+rH \[Gamma])))/(dH dL (-1+rL (-1+\[Beta])-rH \[Beta]))
Show[ContourPlot[g[\[Gamma],rH],{\[Gamma],0,1},{rH,1,5}],%]


It seems that it has something to do with the aspect ratio. If I specify the AspectRatio -> 5 in the contour plot, the vector field seems correct. I am able to get a sensible plot by manually multiplying the gradient in y axis by 10 (since specifying AspectRatio -> 5 actually gives you 1:10 visual aspect ratio).

I am still interested in what's behind the scene. It is a bug?

• Please post the code instead of just the image. Aug 10, 2019 at 5:01
• @C.E.Thanks for reminding. Added it in last edit. Aug 10, 2019 at 18:49
• What happens if you use AspectRatio -> Automatic or a domain whose side-lengths are equal? Orthogonality is not preserved if the axial directions are scaled by different magnitudes. Aug 10, 2019 at 22:30
• @MichaelE2 There is no problem when the side-lengths are equal. I think Mathematica gives the wrong vector plot when the side-lengths are scaled by different factors. The arrows are not pointing to the correct directions. Aug 10, 2019 at 22:35
• No, the problem is that when the scaling factors are different, angles are not preserved. It's not the fault of Mathematica. It's how geometry works. You have to use the same unit length on each axis to get an accurate picture of the angles. (Of course, it is possible that M has miscomputed the vectors, but I doubt it's likely.) Aug 10, 2019 at 22:47