trendline

To get trend-line's equation (polynomial, order 2)

To get trend-line's equation (polynomial, order 2) Question: A simple dataframe that I want to plot it with its trend-line (polynomial, order 2). However I got the equation obviously wrong: y = 1.4x**2 + 6.6x + 0.9 It shall be: y = 0.22×2 – 1.45x + 11.867 # the "2" after x is square How …

Total answers: 1

Adding a 2nd order polynomial trend line px.scatter

Adding a 2nd order polynomial trend line px.scatter Question: I have a data (a lot of rows in a dataframe) and was able to generate a linear trend line. I want also to add to the plot 2nd order polynomial trend line. How can this be done? thanks this is the code only on one …

Total answers: 1

Python scatter plot and matplotlib

Python scatter plot and matplotlib Question: I have a scatter plot in python onto which i want to draw a trendline. From the various examples i have found around the internet to learn how to draw the trendline my code is the following: import matplotlib.pyplot as plt import numpy as np x=np.array([9.80,13.20,13.46,14.09,13.96,10.77,8.79,8.61,8.83,11.08,10.13,12.40,9.90,10.96,12.75,11.79,11.79,12.38,12.78,13.08,12.83,12.57,12.96,12.90,12.91,13.67,12.83,12.50,12.42,12.83,12.82,12.70,12.60,12.90,13.20]) y=np.array([0.0706,0.0969,0.0997,0.1031,0.0848,0.1044,0.0815,0.1030,0.0783,0.0970,0.1193,0.0796,0.0697,0.0738,0.0895,0.0912,0.0887,0.0973,0.0942,0.1052,0.0984,0.0965,0.0903,0.0876,0.1071,0.0872,0.0857,0.0967,0.0926,0.0837,0.0967,0.0935,0.0946,0.0930,0.0758 ]) plt.scatter(x, …

Total answers: 4

How to add trendline in python matplotlib dot (scatter) graphs?

How to add trendline in python matplotlib dot (scatter) graphs? Question: How could I add a trendline to a dot graph drawn using matplotlib.scatter? Asked By: user3476791 || Source Answers: as explained here With help from numpy one can calculate for example a linear fitting. # plot the data itself pylab.plot(x,y,’o’) # calc the trendline …

Total answers: 2