How can I make the horizontal lines below follow through the data points?
I have some Pandas DataFrame objects which contain data on actual and predicted values over time (the image below shows temperature actual (blue) vs predicted (orange) using seaborn). I would like a line of best fit to pass through both the actual and predicted values to easily compare whether the predicted values follow the trend of the actual ones. The example shown below is fairly clear to see that it does, but not all of the data sets are as straight forward.
So far using seaborn, there seems to be very limited support for such non-linear lines of best fit. I used lmplot
sb.lmplot(x='Epoch', y=HOURLYDRYBULBTEMPC', hue='Test', data=data, size=20)
to draw the graph below, which draws linear regression lines straight through the middle. There is an order
parameter which uses numpy.polyfit, but it isn't capable of fitting to such a pattern of data.
Is there something I can use that will do this?
If not, I could write some code which splits the x axis into n number of buckets, take the average of each bucket, and plot them on the graph drawing a line between them; but then if I calculate those points, I still haven't come across a way to plot/overlay that on the graph either.
Most of the other Q&As on this talk about either linear regression lines, or fitting a specific curve type to the data for the fit, but that would be too time consuming with the amount of different datasets this needs to be applied to, and not all of them will follow a nice curve that is modeled easily.
Any help is appreciated, thanks.