ListStreamPlot can't present closed curve with StreamStyle -> “Line”

I try this code to plot streamline

data = Table[{{x, y}, {-y, x}}, {x, -2, 2, 1/200}, {y, -2, 2, 1/200}];
ListStreamPlot[data, StreamStyle -> "Line", StreamPoints -> 4]


It returns

Question: In the picture, the lines are not closed in the red circles.

So, how to get closed curves use parameters of ListStreamPlot? Thank you!

• Might be hard to get to be done automatically, given that numerics usually won't give exactly closed curves, esp. with discrete data. -- I mean, with the discrete data, one has to assume how the vector field is to be estimated/interpolated. How do you know the resulting vector field has closed curves? Any perturbation of {-y, x} tends to destroy the closed curves. – Michael E2 May 31 '17 at 12:24
• @MichaelE2, I know that the data I want to plot has closed streamline from its physical meaning, so I want to get closed curves within MMA. In my question, I just present an example. How to get closed curves with some additional process? Thank you! – tanghe2014 May 31 '17 at 13:16
• A hack: ListStreamPlot[data, StreamStyle -> "Line", StreamPoints -> 4] /. Line[{a_, b__}] :> Line[{a, b, a}] but it doesn't look good for the reason Michael gives. – MikeLimaOscar May 31 '17 at 13:31
• Can you estimate a potential function or some invariant for the field? You could use it to draw level curves, which would approximate the closed orbits. – Michael E2 May 31 '17 at 16:17
• @MichaelE2, I cannot get potential function. I only have velocity vectors. – tanghe2014 Jun 2 '17 at 2:59

Here's what I had in mind for estimating a potential function:

grad = MapAt[{-#[[2]], #[[1]]} &, data, {All, All, 2}];
pot = Accumulate@grad[[All, All, 2, 1]] + Accumulate /@ grad[[All, All, 2, 2]];

ListContourPlot[pot, DataRange -> {{-2., 2.}, {-2., 2.}}]


The potential function could be multiplied by Δx Δy, but there's no real need to do it for the plot.

ListStreamPlot[data, StreamStyle -> "Line", StreamPoints -> 4] /.
Line -> (BSplineCurve[#, SplineClosed -> True] &)