# Get parametervalues from ParametricPlot?

From an examplary plot

plot = ParametricPlot[{1 Cos[s] , 2 Sin[s]}, {s, 0, 2 Pi}]


I know how to get the plotted points

pi = Cases[plot, Line[p_] :> p, Infinity][[1]];



Additionally I would like to get the parametervalues s (automatically used by ParametricPlot) of the plotted points pi: {s[i],p[i]}

How to do that? Thanks!

• for the specific example, angles = First@Cases[pp, Line[x_] :> ArcTan @@@ x, All].
– kglr
Commented Dec 5, 2021 at 10:58
• @kglr Thanks, the example seems to be to easy. How to proceed if you don't know the context between Point and Parameter? Commented Dec 5, 2021 at 11:03
• would this be cheating: f[s_] = {1 Cos[s], 2 Sin[s]}; {plot, evals} = Reap[Block[{e = 0}, ParametricPlot[f[s], {s, 0, 2 Pi}, EvaluationMonitor :> Sow[Tooltip[{Opacity[0], Point[f@s]}, s]]]]]; Show[plot, Graphics[{Red, evals}]]?
– kglr
Commented Dec 5, 2021 at 11:04
• @kglr ParametricPlot uses a set of parametervalues s[ i] for every plotted point p[i]. Unfortunately plot doesn't keep this context. Commented Dec 5, 2021 at 11:10
• .. that is, we can't even identify the min and max of the parameter from plotted points.
– kglr
Commented Dec 5, 2021 at 11:15

Modified an example from the EvaluationMonitor document.

f[s_] = {1 Cos[s], 2 Sin[s]};
{plot, evals2} =
Reap[ParametricPlot[f[s], {s, 0, 2 Pi},
EvaluationMonitor :> Sow[{s, f[s]}]]];
evals2

f[s_] = {1 Cos[s], 2 Sin[s]}; {plot, evals} =
Reap[Block[{e = 0},
ParametricPlot[f[s], {s, 0, 2 Pi},
EvaluationMonitor :> Sow[Tooltip[Point@f[s], s], ++e]]]];
Show[plot, Graphics[{Red, evals}]]


• Thanks! evals only give the plotted points, but not the corresponding parametervalues s ! Commented Dec 5, 2021 at 11:00
• @UlrichNeumann Show[plot, Graphics[{Red, evals}]] // FullForm or put your mouse in the figure. Commented Dec 5, 2021 at 11:10
• How would I extract the tooltip values to a separate list? Commented Dec 5, 2021 at 11:32
• @UlrichNeumann evals2[[1, ;; , 1]] == Cases[FullForm[evals], Tooltip[_, a_] :> a, Infinity] return True Commented Dec 5, 2021 at 12:14
f[s_] := {1 Cos[s], 2 Sin[s]}

{plot, slist} = Reap[ParametricPlot[f[Sow@s], {s, 0, 2 Pi}]];

Show[plot,
ListLinePlot[f /@ Sort[slist[[1]]],
PlotStyle -> Directive[Opacity[.5], CapForm["Butt"], AbsoluteThickness[10],  Red]]]


g[s_] := {Sin[5 s], Sin[4 s]}
{plot, slist} = Reap[ParametricPlot[g[Sow@s], {s, 0, 2 Pi}]];

Show[plot,
ListLinePlot[g /@ Sort[slist[[1]]],
PlotStyle -> Directive[Opacity[.5], CapForm["Butt"], AbsoluteThickness[10], Red]]]


Update: If we have a Graphics object for a curve generated by ParametricPlot and know only the range of the parameter s, we can use a combination of BSplineFunction, Nearest and Rescale to reconstruct the list of parameter values associated with line coordinates:

{smin, smax} = {0, 2 Pi};

f[s_] := {1 Cos[s], 2 Sin[s]};

plotf = ParametricPlot[f[s], {s, smin, smax}, ImageSize -> 400];

coordsf = Cases[plotf, Line[x_] :> x, All][[1]];

bSFf = BSplineFunction[coordsf];

slistf = Rescale[
Values @ Association[
SortBy[Nearest[coordsf][bSFf @ #][[1]] -> # & /@ Subdivide[4000], Last]],
{0, 1}, {smin, smax}];

Show[plotf,
ListLinePlot[f /@ Sort[slistf],
PlotStyle -> Directive[Opacity[.5], CapForm["Butt"], AbsoluteThickness[10], Red]]]


g[s_] := {Sin[5 s], Sin[4 s]}

plotg = ParametricPlot[g[s], {s, smin, smax}, ImageSize -> 400];

coordsg = Cases[plotg, Line[x_] :> x, All][[1]];

bSFg = BSplineFunction[coordsg];

slistg = Rescale[
Values @ Association[
SortBy[Nearest[coordsg][bSFg @ #][[1]] -> # & /@ Subdivide[4000], Last]],
{0, 1}, {smin, smax}];

Show[plotg,
ListLinePlot[g /@ Sort[slistg],
PlotStyle -> Directive[Opacity[.5], CapForm["Butt"], AbsoluteThickness[10], Red]]]


• That's it , thank you! Surprisingly slist (* {{0, 0.000128228, s, 0., 0.12333, 0.257035...}} *) starts with symbol s at the third position? Commented Dec 5, 2021 at 11:55
• @UlrichNeumann, interesting; no idea why s is there.
– kglr
Commented Dec 5, 2021 at 12:02