How to eliminate extraneous lines when using Mod within ParametricPlot?

I've found two other similar questions:

Plot of the Mod of NDSolve solutions sometimes connects discontinuous jumps

and

How can I remove horizontal lines on a phase plot for a pendulum?

Neither contains a solution to my problem, but in an answer to the first there is a tantalizing note: This seems to have been fixed in V11. Alas I'm running V11 and getting a very similar issue that I would love to get rid of. Here's my code:

Manipulate[
Animate[sol =
NDSolve[{x'[t] == w1 + k1*Sin[y[t] - x[t]],
y'[t] == w2 + k2*Sin[x[t] - y[t]], x == x0, y == y0}, {x,
y}, {t, 0, tmax}];
ParametricPlot[Mod[{x[t], y[t]} /. sol, 2 Pi], {t, 0, tplot},
PlotRange -> {{0, 2 Pi}, {0, 2 Pi}}], {tplot, 0, tmax}],
{{w1, 1}, -2, 2}, {{w2, 1}, -2, 2}, {{k1, 0.1}, 0, 2}, {{k2, 0.1}, 0,
2}, {{x0, 0}, 0, 2 Pi}, {{y0, 0.2}, 0, 2 Pi}, {{tmax, 10}, 0, 100}
]


This is a simple coupled oscillator problem; the phase space is naturally the torus, i.e. the square with opposite edges identified. The obvious way to plot the solution then is Mod[], but we get the following: The horizontal and vertical line shouldn't be there. I understand why they're added by ParametricPlot but I would like to get rid of them. I have tried using Exclusions; I have tried using WhenEvent within the NDSolve to reset x and y to zero so that the Mod[] is unnecessary and I get exactly the same output. Surely there's a solution? Perhaps ParametricPlot can be told to ignore jumps greater than $\varepsilon$? I don't need it to be perfect.

Manipulate[Animate[sol = NDSolveValue[{x'[t] == w1 + k1*Sin[y[t] - x[t]],
y'[t] == w2 + k2*Sin[x[t] - y[t]], x == x0, y == y0}, {x,  y}, {t, 0, tmax}];
ParametricPlot[Mod[Through@sol@t, 2 Pi], {t, 0, tplot},
PlotRange -> {{0, 2 Pi}, {0, 2 Pi}}, PerformanceGoal -> "Quality",
ImageSize -> 300], {tplot, 0, tmax}, Alignment -> Center],
{{w1, 1}, -2, 2}, {{w2, 1}, -2, 2}, {{k1, 0.1}, 0, 2}, {{k2, 0.1}, 0, 2},
{{x0, 0}, 0, 2 Pi}, {{y0, 0.2}, 0, 2 Pi}, {{tmax, 10}, 0, 100},
Alignment -> Center, ContentSize -> 500] Update: You can also use:

Manipulate[Animate[sol =  NDSolve[{x'[t] == w1 + k1*Sin[y[t] - x[t]],
y'[t] == w2 + k2*Sin[x[t] - y[t]], x == x0, y == y0}, {x, y}, {t, 0, tmax}];
m[t_] := Mod[{x[t], y[t]} /. sol, 2 Pi];
ParametricPlot[m[t], {t, 0, tplot}, PlotRange -> {{0, 2 Pi}, {0, 2 Pi}},
PerformanceGoal -> "Quality"], {tplot, 0, tmax}],
{{w1, 1}, -2, 2}, {{w2, 1}, -2, 2}, {{k1, 0.1}, 0, 2}, {{k2, 0.1}, 0, 2},
{{x0, 0}, 0, 2 Pi}, {{y0, 0.2}, 0, 2 Pi}, {{tmax, 10}, 0, 100}]

• This works but I don't understand why. Is it the fact that you used NDSolveValue instead of NDSolve? If I add PerformanceGoal->"Quality" to my original example it doesn't fix the problem, so that can't be the whole story. – dbx Mar 14 '18 at 15:28
• @dbx, I needed both. – kglr Mar 14 '18 at 15:32
• @dbx, it turns out NDSolveValue is not necessary; if you define the function to be plotted outside ParametricPlot, that is, m[t_] := Mod[{x[t], y[t]} /. sol, 2 Pi]; ParametricPlot[m[t],...] you get the desired result. – kglr Mar 14 '18 at 15:45
• Haha OK, thank you. This definitely answers the question, but... it raises some new ones!! – dbx Mar 14 '18 at 15:59

As a workaround you can use ListPlot instead of ParametricPlot

Manipulate[
sol = NDSolve[{x'[t] == w1 + k1*Sin[y[t] - x[t]],
y'[t] == w2 + k2*Sin[x[t] - y[t]], x == x0, y == y0}, {x,
y}, {t, 0, tmax}]; Animate[
ListPlot[
Table[Mod[{x[t], y[t]} /. sol, 2 Pi], {t, 0, tplot, 0.05}],
PlotRange -> {{0, 2 Pi}, {0, 2 Pi}},
PlotStyle -> {Blue, PointSize[Tiny]}],
{tplot, 0, tmax}], {{w1, 1}, -2, 2}, {{w2, 1}, -2, 2}, {{k1, 0.1},
0, 2}, {{k2, 0.1}, 0, 2}, {{x0, 0}, 0, 2 Pi}, {{y0, 0.2}, 0,
2 Pi}, {{tmax, 10}, 0, 100}] 