title: Sklearn logistic regression, plotting probability curve graph
body: <p>I'm trying to create a logistic regression similar to the ISLR's example, but using python instead</p>
  
  <pre><code>data=pd.read_csv("data/Default.csv")
  
  #first we'll have to convert the strings "No" and "Yes" to numeric values
  data.loc[data["default"]=="No", "default"]=0
  data.loc[data["default"]=="Yes", "default"]=1
  X = data["balance"].values.reshape(-1,1)
  Y = data["default"].values.reshape(-1,1)
  
  LogR = LogisticRegression()
  LogR.fit(X,np.ravel(Y.astype(int)))
  
  #matplotlib scatter funcion w/ logistic regression
  plt.scatter(X,Y)
  plt.xlabel("Credit Balance")
  plt.ylabel("Probability of Default")
  </code></pre>
  
  <p>But I keep getting the graph on the left, when I want the one on the right:</p>
  
  <p><a href="https://i.stack.imgur.com/bdOsp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bdOsp.png" alt="enter image description here"></a></p>
  
  <p>Edit: <code>plt.scatter(x,LogR.predict(x))</code> was my second, and also wrong guess.</p>