I have a list of data in the form of {x,y} (30K only). The discrete data give two curves with a cross point.
pts = ToExpression /@ Import["~\\testdata.csv"];
ListPlot[pts, PlotRange -> {{0, 3}, {-1, 0.1}}, Frame -> True, ImageSize -> 300, AspectRatio -> 0.6]
My goal:
I would like to plot 2 independent smooth curves according to these points in one graphic as follows. The 2 curves are expected based on their physical meaning.
My trial:
I have tried to separate the two curves using the
Unshufflefunction provided by @Victor K. in this answer, but it seems that when the two curves are crossing, that code cannot separate them as expected.{LstA, LstB} = Unshuffle[pts]; unshufflePlot = ListPlot[{LstA, LstB}, PlotStyle -> {Black, Green}, PlotRange -> {{1, 1.5}, {-0.4, -0.15}}, Frame -> True, ImageSize -> 400, AspectRatio -> 0.6]
I also tried
FindCurvePath, which even only gives a small part of the plot...curves = FindCurvePath[pts]; FindCurvePlot = ListLinePlot[pts[[curves[1]]], PlotRange -> {{1, 1.5}, {-0.4, -0.15}}, Frame -> True, ImageSize -> 400, AspectRatio -> 0.6]
- As suggested by @Domen, I tried the
findCurvesfunction in this link, however, it still cannot separate the different curves from the mixed dataset. What it gives is some mixed curves depending on the value of eps infindCurves.
Now, I have no idea to solve this problem. Can someone give some suggestions? Thank you in advance :)







curves = findCurves[data, .03]produces desired results. – Domen Mar 01 '23 at 14:38