title: Linear regression - equation on the plot - Python
body: <p>Hey I want to do linear regression and create a plot on which will be also equation of my model. I have following code:</p>
  <pre><code>from sklearn.linear_model import LinearRegression
  
  X = np.array((1,2, 3, 4))
  Y = np.array((3, 1, 4, 5))
  
  X = X.reshape((-1, 1))
  model = LinearRegression().fit(X, Y)
  
  
  plt.scatter(X, Y, color='g')
  plt.plot(X, model.predict(X),color='k')
  
  print(model.coef_[0], model.intercept_)
  </code></pre>
  <p>How to write equation on my plot automatically?</p>