Loglog option makes linear regression look wrong

Hello community!
I am using a loglog plot and a linear regression on top of it.
My linear regression looks curved. How can I impose different axes on the graph?

plt.xscale('log')
plt.yscale('log')
x = np.array(mini['num'])
y = np.array(mini['percentage'])

plt.rcParams["figure.figsize"] = (10,10)
plt.plot(y, 'g^')

m, b = np.polyfit(x,y, 1)
plt.plot(m*x+b)

You’re not plotting against x, but against np.arange(len(y)).

1 Like

Thank you for your answer, that does not quite solve it unfortunately.
(The shape of the graph is not modified)