title: How to plot a 1D K-means cluster
body: <p>I have a vector (X2) and I would like to investigate the groups they can form.
  I have performed the K-means analysis, whith 2 clusters:
  shape X2 = (19,1)</p>
  <pre><code>kmeans = KMeans(n_clusters=2,random_state=123)                 
  kmeans.fit(X2)                                                
  label = kmeans.fit_predict(X2)
   
  print(label)
  [0 0 1 0 1 1 0 1 1 0 0 1 0 1 1 0 0 1 0]
  </code></pre>
  <p>Now I would like to make the scatter plot of these 2 clusters.
  Could someone help me with the plot.</p>
  <p>I'm not sure how I can associate the label with my vector (X2) and what to put in x-axis and y-axis.</p>
  <p>I would like to have something like this:
  <a href="https://i.stack.imgur.com/zl02E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zl02E.png" alt="K means 2 clusters" /></a></p>
  <p>But I don't know how to organize the plot, because the labels are not the x-axis. I now the y-axis (X2), what is missing is the x-axis and how to associate the labels with colors to X2</p>