2D Cross-section of data points

89 Views Asked by At

I have a set of points with x and y values. I would like to draw a straight line through these points and have a cross section through these points. Said another way, I would like to rotate these points onto a horizontal line such that the distance between the point's aperpendicular projection onto my best fit line is preserved. Basically I want to look at the points as they sit on my big dashed black line. link to an illustration of my problem

1

There are 1 best solutions below

0
On

Obtain the dashed line through your favorite linear regression method, or however you choose to do it. Your picture looks like Total Least Squares.

Once you have the line, you want to do a projection of the points onto that line's vector. Since you're working in "affine space" (i.e. not ever line goes through the origin), translate your points and line so the line passes through the origin, then do your projection, then un-translate the points.