Split data into linear regression

I am looking for a way that could help me create more precise models.

Let's say these are real estate prices for different areas. Only in the data I do not have a clear division into these areas I suppose this is the relationship.

At present I have one model (red line) and I would like to have n models, eg 3. Additional two green lines. And use them for points that are closer to this line.

How convenient to go about it?

What measure should be used to divide this data and apply linear regression so that the variance is as low as possible?

May I have some inspiration :)?

You schould check pandas qcut

Below I will put results and some code

labels = ['weak', 'medium', 'strong']
df['label'] = pd.qcut(df['values_to_divide'], len(labels), labels=labels)


You can check the histogram of y/x. Using only values of x far from zero would be necessary, in your case its not a problem because prices are far from zero.

If in your case the three different distributions have intercept near 0, you may have useful results. You can also try to check the histogram of (y-intercept)/x.

You should find different modes in the distribution of this quotient. You could then divide the dataset according to different values of this quotient.