I am trying to plot a linear regression on a logarithmic
> scale and am not quite sure how to do it. I used examples
> that I had found online but the linear regression line
> doesn't plot the same on a logarithmic scale. Can anyone
> help me? Here is what I have so far:
This is not an issue of log versus non-log. You should sort your
xdata before plotting the line; you just don't notice it when you plot
nonsorted data that all lie on the same line.
Just do this after your data definition
prediction_experiment.sort()
Also, rather than
x = [f[0] for f in prediction_experiment]
y = [z[1] for z in prediction_experiment]
x = array(x)
y = array(y)
you might prefer
x, y = map(array, zip(*prediction_experiment))
JDH