Can one reorder a list for parameterization?

datab = FindCurvePath[dataa];
dataa = dataa[[Flatten[datab]]];
ListPlot[dataa]

enter image description here

If the list is split, just run

datab = FindCurvePath[dataa];
dataa = dataa[[Flatten[datab]]];

again, or go to the next step. If it still doesn't work, run this code

datad = Table[
   dataa[[i]] - dataa[[i + 1]], {i, 1, Length[dataa] - 1}];
splitp = Position[datad[[All, 2]], Max[datad[[All, 2]]]][[1]][[1]]
dataa = Catenate[{Reverse[dataa[[1 ;; splitp]]], 
    dataa[[splitp+1 ;; Length[dataa]]]}];

As the code doesn't always produce the same result, you may have to run the entire code more than once, but eventually it sorts. You can run:

Manipulate[ListPlot[dataa[[1 ;; a]],
PlotRange -> {{-2 Pi, 2 Pi}, {-1, 1}}], {a,1, Length[dataa], 1}]

To determine if the list is properly arranged.

If the list is reversed, use Reverse[dataa] to fix.

enter image description here


Your problem can likely be avoided entirely by using Jens's lovely routine contourRegionPlot:

  • Saner alternative to ContourPlot fill

Compare these results:

p1 = ContourPlot[Im[ArcSin[x + I y]], {x, -2, 2}, {y, -2, 2}, Exclusions -> None];

p2 = contourRegionPlot[Im[ArcSin[x + I y]], {x, -2, 2}, {y, -2, 2}];

GraphicsRow[{p1, p2}]

{pts1, pts2} = Cases[#, {_, _}, {-2}] & /@ {p1, p2};

ListLinePlot /@ {pts1, pts2} // GraphicsColumn

enter image description here


Perhaps ListCurvePathPlot can help you do what you want?