fit linear regression to logarithmic scale matplotlib code example
Example: logarithmic scale fitting python
fig=plt.figure()
ax = fig.add_subplot(111)
z=np.arange(1, len(x)+1)
logA = np.log(z)
logB = np.log(y)
m, c = np.polyfit(logA, logB, 1, w=np.sqrt(y))
y_fit = np.exp(m*logA + c)
plt.plot(z, y, color = 'r')
plt.plot(z, y_fit, ':')
ax.set_yscale('symlog')
ax.set_xscale('symlog')
plt.xlabel("Pre_referer")
plt.ylabel("Popularity")
ax.set_title('Pre Referral URL Popularity distribution')
plt.show()