0
$\begingroup$

Can anyone help, why ListVectorPlot and ListStreamPlot show vectors and streamlines lying outside the allowed domain? Here is my Mathematica code:

pp = Table[{r Cos[ϕ], r Sin[ϕ]}, {r, 0, 10, 
    0.5}, {ϕ, -π/6, π/6, 0.1}];
vv = Table[{{r Cos[ϕ], r Sin[ϕ]}, {1, 0}}, {r, 0, 10, 
    0.5}, {ϕ, -π/6, π/6, 0.1}];
GraphicsRow[{ListPlot[pp], ListVectorPlot[vv], ListStreamPlot[vv]}]

And I get the plots:

enter image description here

Why do the vectors in the second and third cases fill the whole square instead of the section of a circle?

$\endgroup$
  • $\begingroup$ Because ListVectorPlot performs interpolation. $\endgroup$ – Feyre Oct 28 '16 at 21:50
1
$\begingroup$

Workaround:

region = Function[{x, y, vx, vy, n}, 
   Sqrt[x^2 + y^2] < 10 && x != 0 && -π/6 < ArcTan[y/x] < π/6];

GraphicsRow[{ListPlot[pp], 
  ListVectorPlot[vv, RegionFunction -> region], 
  ListStreamPlot[vv, RegionFunction -> region]}]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you. It works, but I still do not understand, why Mathematica plotted vectors beyond the domain, and why one should to impose this domain again on the plot. $\endgroup$ – Tomala Oct 28 '16 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.