Plot gradient vector in ContourPlot

3 replies · 5K views · last reply
Lambda96
Messages
233
Reaction score
77
TL;DR
Plot gradient vector in ContourPlot
Hi,

I have made the following ContourPlot in mathematica and now I wanted to ##\vec{r}_1= \left(\begin{array}{c} -1 \\ 1 \end{array}\right)##, ##\vec{r}_2= \left(\begin{array}{c} 0 \\ \sqrt{2} \end{array}\right)## and ##\vec{r}_3= \left(\begin{array}{c} 1 \\ 1 \end{array}\right)## insert the gradient into the ContourPlot.

Filled contour plot of x/sqrt(x^2+y^2+1) over x and y from -5 to 5, with bands shaded blue on the left, tan near x=0, and pale yellow on the right.


Is this possible and if so, how?
 
Thank you Orodruin for your help 👍

Since I want to have the vectors at certain points in the ContourPlot, I used ListVectorPlot[{{x1,y1},{vx1,vy1}},...}].

Unfortunately, Mathematica then plots a vector field

Mathematica ListVectorPlot of a vector field on x from 0 to 1 and y from -1 to 1.4, with arrows coloured from orange-yellow to blue by magnitude, pointing mostly right at top and up-right at bottom.