title: Plotting data point in different clusters
body: <p>I have my data points and cluster number as follows:</p>
  
  <pre><code>X        Y       cluster
  -0.42042 0.2071  0
  -1.4986  -1.8658 0
  -0.50905 -0.0751 0
  2.1978   1.9568  1
  1.4901   1.6177  1
  1.6961   1.8293  1
  1.6021   0.0857  1 
  0.87831  0.71435 1
  2.6688   1.3426  1
  -1.741   0.90686 2
  -1.8332  0.35599 2
  -3.0733  0.42656 2
  -2.1991  0.41843 2
  -2.8099  0.93542 2
  -1.3631  1.0914  2
  </code></pre>
  
  <p>The above data was unsorted, so I used <code>sortrows</code>  to sort in terms of cluster number and I get the above data. </p>
  
  <p>I have to plot these clusters. Is there any MATLAB function for plotting clusters? I know we can use something like this: <code>plot(M(:,1), M(:,2), '.');</code> </p>
  
  <p>But this plot all values in one cluster. I have to plot in three clusters as per data. The clusters  are 0, 1,2. So three clusters with three different colors should be plotted. So something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/VAqBu.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/VAqBu.jpg" alt="enter image description here"></a> </p>
  
  <p>Any idea how to go about it?    </p>