3

enter image description here

My Question:

How can i draw a curve though this data, thus describing an equation for this plot..

I generated this scatter plot by following code, but I am not able to figure out how to generate an equation for this data and draw the corresponding curve on this plot simultaneously. Please Help.!

def draw(data,xlabel,ylabel):
    print('length of data : ',len(data))
    x,y = [],[]
    for i in data:
        x.append((i[1]))
        y.append((i[0]))
    plt.scatter(x, y,marker=r'o',color='b')
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)
    plt.show()

Basically I want something like this:enter image description here

1 Answer 1

3

You have to perform a curve fitting procedure, which is called a regression problem in mathematics. In your case it seems that data is more or less exponential, but you can fit arbitrary function through scipy.optimize.curve_fit

http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot found the best..:)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.