This question is strongly related to the question upper envelope of data. This question is, essentially, how to find the upper and lower envelope of a list of points.
Using bill s's answer, one can get something that works fairly well.
Sample data
pts = Transpose[{
RandomReal[{0, 10 Pi}, 2000],
RandomReal[{0, 10}, 2000]
}];
inRegionQ[{x_, y_}] := y > 3 + Sin[x] && y < 5 + Sin[x]
pts = Select[pts, inRegionQ];
plot = Plot[
{3 + Sin[x], 5 + Sin[x]},
{x, 0, 10 Pi},
PlotRange -> {{0, 10 Pi}, {0, 10}},
Epilog -> {Gray, Point[pts]}
]
Solution
sorted = SortBy[pts, First];
xvalues = sorted[[All, 1]];
yvalues = sorted[[All, 2]];
max = Transpose[{xvalues, GaussianFilter[MaxFilter[yvalues, 5], 5]}];
min = Transpose[{xvalues, GaussianFilter[MinFilter[yvalues, 5], 5]}];
ListLinePlot[{min, max}, Epilog -> {Gray, Point[pts]}]
One can play with the parameters to get smoother lines or lines that fit more or less snugly.
ConvexHullMesh
). $\endgroup$